1

00:00:01,060  -->  00:00:09,590
Not look at the next type of operators bitwise operators as the name implies bitwise operators work

2

00:00:09,590  -->  00:00:18,200
with individual bits of our prince an opening it can be either in digit primitives or bullion bullion

3

00:00:18,200  -->  00:00:24,880
is operant is very rarely used also discussing I maybe corporators be discussed about something called

4

00:00:24,930  -->  00:00:30,190
or put in promotion rule that are put in smaller than aned are automatically promoted.

5

00:00:30,220  -->  00:00:34,120
And that also applies here for bitwise operators.

6

00:00:35,460  -->  00:00:38,980
Also note is that we said bitwise operators book at Bigler.

7

00:00:39,570  -->  00:00:46,660
But then we are also saying that operands can be integers what that means is because operators would

8

00:00:46,660  -->  00:00:53,020
actually consider the binary representation of indigent operands and then operate on them at big limit

9

00:00:54,050  -->  00:00:55,580
vivants only a few examples.

10

00:00:55,640  -->  00:01:02,670
When looking at each of the operators before you look at the operators before you discuss that because

11

00:01:02,770  -->  00:01:11,270
operators are mostly used one to they're heavily used is an embedded system applications which work

12

00:01:11,270  -->  00:01:16,510
in resource constrained environments for example in such environments you may have to work with very

13

00:01:16,510  -->  00:01:23,140
limited memory and such a guest thinks has to be manipulated very efficiently and because operators

14

00:01:23,260  -->  00:01:24,890
can play an important role here.

15

00:01:26,570  -->  00:01:32,480
They're also typically used in hospitals and if you don't know what a hostel is just don't worry it

16

00:01:32,480  -->  00:01:33,940
will be covered later.

17

00:01:34,250  -->  00:01:40,720
But it's a fundamental data structure like NRD on in Java there is a data structure called hash map

18

00:01:41,040  -->  00:01:43,270
which we will also study later.

19

00:01:43,270  -->  00:01:46,600
It is basically a hostage implementation and dentally.

20

00:01:46,600  -->  00:01:54,140
It does make use of couple of bitwise operators It seems bitwise operators are also heavily used in

21

00:01:54,140  -->  00:02:00,540
data compression and data encryption fuse generally speaking there is a good chance that you may never

22

00:02:00,550  -->  00:02:05,980
use because operators unless you are doing some really low level programming work where performance

23

00:02:05,980  -->  00:02:09,300
is critical and things have to be managed very efficiently.

24

00:02:10,260  -->  00:02:15,450
But let's learn how backwards operators work and in case you happen to work on projects that need bitwise

25

00:02:15,450  -->  00:02:18,410
operations then you will know how to make use of them.

26

00:02:20,400  -->  00:02:27,220
Adhere to the forbit operators bitwise and bitwise OR bit was exclusive you are and it was not.

27

00:02:27,640  -->  00:02:36,580
Let's not look at each of them fosters because an operator like logical and operator big words and also

28

00:02:36,580  -->  00:02:45,230
use an impersonal symbol Howard because I use this only as single and percent because I know Peter would

29

00:02:45,230  -->  00:02:54,760
written one if bought and put Sarwan let's just consider an example where x is an NY study playing with

30

00:02:54,760  -->  00:03:00,530
words and on x and y will return an integer value of 1 and to see how.

31

00:03:00,740  -->  00:03:03,730
Let's consider the binary representations of x and y.

32

00:03:05,350  -->  00:03:09,280
On here the first one is for X. Well second one represents.

33

00:03:10,310  -->  00:03:13,550
As you can see only the last bit of both number one.

34

00:03:13,680  -->  00:03:19,160
And so in the output only the last bet would be one and the rest would be zero.

35

00:03:19,190  -->  00:03:27,200
So the result is that decimal value of an operations or brilliance instead of integers then all bitwise

36

00:03:27,200  -->  00:03:32,730
operators would create the boolean value grew as one and font size zero.

37

00:03:32,960  -->  00:03:40,310
So just keep that in mind as the examples we discuss here will only deal with integers next is because

38

00:03:40,400  -->  00:03:47,420
autopen are to like logical art because are also used as a pipe symbol but it uses on the single pipe

39

00:03:49,470  -->  00:03:56,880
because Oddworld read and one if one off the end put Mrs. Van you know one example where X is one on

40

00:03:56,880  -->  00:04:02,630
Y U Street playing big boys or on x and y will read the entry and to see how.

41

00:04:02,710  -->  00:04:06,230
Let's once again consider the binary representations of x and y.

42

00:04:08,430  -->  00:04:13,050
As you can see we have one in the output if one off the and put this one.

43

00:04:13,530  -->  00:04:23,930
So the result is the decimal value three next is big exclusive OR operator but you got it's a moot because

44

00:04:23,940  -->  00:04:31,070
exclusives are written so one if only one of the puppets is one that is even if both and put bits out

45

00:04:31,070  -->  00:04:33,570
of one then it would still return to zero.

46

00:04:33,950  -->  00:04:41,130
And that's the main difference between bitwise exclusive or on bitwise OR you know one example where

47

00:04:41,130  -->  00:04:49,640
X is one on y history applying bitwise exclusive or on x and y will return a value off to adhere to

48

00:04:49,670  -->  00:04:55,720
the binary representations as you can see we have one in the output only if one of the input bits is

49

00:04:55,730  -->  00:04:58,830
fine but not what the last bits are.

50

00:04:58,820  -->  00:05:04,790
One for both numbers and the corresponding output bit to 0 so the final result is not dissimilar value

51

00:05:04,870  -->  00:05:14,660
to next is Bidvest not operator which is a unity operator and it certainly doesn't mean bitwise NOT

52

00:05:14,750  -->  00:05:22,820
simply in which bits affects operant let's consider that one example where X has been I'm applying bitwise

53

00:05:22,820  -->  00:05:29,400
was not on X will return a value of minus two and to see how let's consider the binary representation

54

00:05:29,400  -->  00:05:34,150
of x as you can see all zeroes are made ones.

55

00:05:34,360  -->  00:05:40,360
And the last bit one is made zero under deserting binary number corresponds to the entire minus two

56

00:05:42,400  -->  00:05:49,060
if you recall we discussed a book short so good operators logical and unlogical are among big operators

57

00:05:49,210  -->  00:05:56,680
big ones and big ones are are also referred to as non-charter so good operators that is there are no

58

00:05:56,680  -->  00:06:00,550
short girls as in the case of short circuit operators.

59

00:06:00,610  -->  00:06:08,080
This means that these operators forced JVM to always check both the options so far because on the right

60

00:06:08,080  -->  00:06:12,700
operand is evaluated even if left operand evaluates to force.

61

00:06:12,730  -->  00:06:20,140
Similarly for bitwise aren't right operand is evaluated even if left operand this rule nobody discussing

62

00:06:20,300  -->  00:06:26,190
it maybe cooperators will look at something called crampon or it might be an assignment operators which

63

00:06:26,190  -->  00:06:34,430
provided a short and elegant syntax bitwise operators also have similar notation it is going to Bishan

64

00:06:34,500  -->  00:06:39,080
involving because I know her first one shows that expanded form.

65

00:06:39,160  -->  00:06:47,280
Well the second one shows a shorter comp on assignment operator and here is an example of a boolean

66

00:06:47,280  -->  00:06:53,340
variable be initialized with the value of true and the second statement is a read initialization of

67

00:06:53,340  -->  00:07:00,370
the same variable b so basically a big rise I kind of grew on fault is being done here which will return

68

00:07:00,380  -->  00:07:01,660
a value of funds.

69

00:07:03,890  -->  00:07:12,410
Similar pompon operators are also going for it because our and words exclusive operators finally let's

70

00:07:12,550  -->  00:07:13,690
look at a quick demo.

71

00:07:13,920  -->  00:07:19,080
A new method called bitwise operators has been added to basics demo class which can be downloaded from

72

00:07:19,080  -->  00:07:20,520
the resources section.

73

00:07:20,910  -->  00:07:22,230
Let's look at the program now.

74

00:07:24,460  -->  00:07:27,540
This is the new method bitwise operators.

75

00:07:27,580  -->  00:07:30,120
And here we are going to demonstrate a few things.

76

00:07:30,160  -->  00:07:37,210
One as big as operators I played on Intimidator pipes and the big guys and they played on Boullion operand

77

00:07:37,630  -->  00:07:40,670
and big wigs are played on Kadek our parents.

78

00:07:40,730  -->  00:07:45,970
I'm finally a big raise or played on doubletake or like which should not compile because because I'll

79

00:07:45,970  -->  00:07:50,170
put it as can be applied only on integers or boolean operations.

80

00:07:50,200  -->  00:07:52,910
Let's just go ahead and compile and exit this.

81

00:07:53,110  -->  00:07:54,830
We need to be in the basics directory

82

00:07:57,690  -->  00:07:57,880
.

83

00:07:58,020  -->  00:07:59,980
And here is the output.

84

00:08:00,000  -->  00:08:06,810
So the first four lines demonstrate the bit was all but it does applied on integer data types.

85

00:08:06,810  -->  00:08:12,030
I'm not going to discuss this as these examples are the exact same examples that we have seen earlier

86

00:08:12,270  -->  00:08:14,270
where X is one on y history.

87

00:08:14,350  -->  00:08:21,030
And here are the different bitwise operators applied on them bitwise and or exclusive or are not.

88

00:08:21,360  -->  00:08:23,400
So we are not going to discuss that.

89

00:08:23,610  -->  00:08:31,430
And the next one is a bit wise or because I and I play it cue and false Richard and so false then a

90

00:08:31,430  -->  00:08:38,940
bit odd is applied on characters that are types and the characters are even be here since there are

91

00:08:38,940  -->  00:08:39,600
characters.

92

00:08:39,600  -->  00:08:46,620
They get promoted done in sort of corresponding values have ninety seven and ninety eight and so that

93

00:08:46,620  -->  00:08:51,360
binary representation so taken on a bitwise OR is applied on them.

94

00:08:51,360  -->  00:08:58,290
So there is only really been ninety nine Next let's see the big words are applied on the database.

95

00:08:58,610  -->  00:09:00,840
And we know that this should not be compiled.

96

00:09:01,160  -->  00:09:04,970
So but let's do component exuded this

97

00:09:10,160  -->  00:09:18,150
and it is there it says that bag open and types for binary operator it only works with integers and

98

00:09:18,450  -->  00:09:23,970
boolean operations and that's the end of our discussion on bitwise operators.
