Java Integer lowestOneBit() MethodThe lowestOneBit() method is a method of Integer class under java.lang package. This method returns int value with at most a single one-bit, in the position of the lowest-order ("rightmost") one-bit in the specified int value. If the specified value has no one-bits or is equal to zero in its two's complement binary representation, it returns zero. Syntax:Following is the declaration of lowestOneBit() method: Parameter:
Returns:The lowestOneBit() method returns an int value with a single one-bit, in the position of the lowest-order one-bit in the specified value, or zero if the specified value is itself equal to zero. Exceptions:NA Compatibility Version:Java 1.5 and above Example 1Output: Integer value in the position of the lowest-order one-bit: 4 Example 2Output: Enter the desired value: 456 Integer value in the position of the lowest-order one-bit: 8 Example 3Output: Input Number is: 25 Lowhest 1-bit of the given integer is: 1 Input Number is = -20 Lowest one bit of the given integer is = 4 Example 4Output: Input Number: 104 Binary Equivalent: 1101000 Total Number of 1-bits: 3 Integer Value of lowest 1-bit: 8 Next TopicJava-integer-max-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India