Java Integer reverse() MethodThe reverse() method of Java Integer class numerically returns the value obtained by reversing the order of the bits in the 2's complement binary representation of the specified integer value. Syntax:Following is the declaration of reverse() method: Parameter:
Returns:The reverse() method returns the numeric value obtained by reversing order of the bits in the specified int value. Exceptions:NA Compatibility Version:Java 1.5 and above Example 1Output: Number = 202 After reversing = 1392508928 Example 2Output: Enter Integer Value: 140 Number = 140 Binary Representation = 10001100 After reversing = 822083584 Example 3Output: Number = 202 Binary Representation = 11001010 After reversing = 1392508928 Number = -50 Binary Representation = 11111111111111111111111111001110 After reversing = 1946157055 Example 4Output: Enter Number from console: 3456546 Result: 4935149145179553792 Next TopicJava-integer-rotateleft-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