|
| ||||||||||
| Tags: bitwise logical operators, bitwise operators, logical operators, operators, operators in java |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Bitwise logical operators in Java
I am studying in second year of the Bsc(I.T). Portion of this year includes JAVA programming.The main thing is that I don't know anything about the bitwise logical operators. Can anyone suggest me, what are the different Bitwise logical operators are available in JAVA language? What is the use of them? |
|
#2
| ||||
| ||||
| Re: Bitwise logical operators in Java
Following are the different bitwise logical operators available in Java: 1. AND(&):1 if both bits are 1. e.g:3 & 5 (result is 1 ) 2.XOR(^):1 if both bits are different. e.g: 5 ^7 (result is 6) 3. OR(|):1 if either bit is 1. e.g:3 | 5 (result is 7) 4.Shift Left(<<):This operator used to Shifts the bits of n left p positions. Zero bits are shifted into the low-order positions. e.g:3 << 2(result is 12)
__________________ Grand Theft Auto 4 PC Video Game |
|
#3
| ||||
| ||||
| Re: Bitwise logical operators in Java
According to my knowledge following Bitwise logical operators are available in the Java: i). NOT operator(~) ii). OR operator(|) iii). AND operator(&) iii). XOR operator(^) For reference see below example of 'AND' operator: Quote:
__________________ The FIFA Manager 2009 PC Game |
|
#4
| ||||
| ||||
| Re: Bitwise logical operators in Java Bitwise logical operators of java operate on individual bits of integer (long & int) values. Suppose If an operand is shorter than an int, it is promoted to int before doing the any operation. Important use of the bitwise logical operators is to work with multiple values that have been encoded within one int. See below example of this: Quote:
|
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Bitwise logical operators in Java" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Use of Bitwise Logical Operators : C | Gavyn | Software Development | 4 | 06-02-2010 03:25 PM |
| How to use Comparison and Logical Operators in JavaScript? | Beter 2 Burn Out | Software Development | 5 | 30-01-2010 06:45 PM |
| Bitwise Concatenation In Int | Aakarshan.d | Software Development | 5 | 25-01-2010 01:41 PM |
| Don't know about short-circuit operators of java | Ram Bharose | Software Development | 5 | 20-01-2010 07:26 AM |
| Memory allocation optimized bitwise | Ricky58 | Software Development | 3 | 07-05-2009 10:53 AM |