Java Integer rotateLeft() Method25 Mar 2025 | 2 min read The rotateLeft() method of Java Integer class returns the value obtained by rotating the two's complement binary representation of the specified int value left by the specified number of bits. (Bits shifted out of the left hand, or high-order). Bit shifting is a bitwise operation which is performed on all the bits of a binary value by moving the bits to a definite number of places towards left or right. Java has a single Logical left shift operator (<<). Explanation:Syntax:Following is the declaration of rotateLeft () method: Parameter:
Returns:The rotateLeft () method returns the value obtained by rotating the two's complement binary representation of the specified int value left by the specified number of bits. Exceptions:NA Compatibility Version:Java 1.5 and above Example 1Output: 40 Example 2Output: Binary equivalent: 10000 Value after left rotation: 128 New Binary value after Rotated Left: 10000000 Example 3Output: Enter the Number: 16 Value: 16 Binary equivalent: 10000 Value: 32 Binary equivalent: 100000 Value: 128 Binary equivalent: 10000000 Example 4Output: Value: -12 Value: -23 Value: -89 Next TopicJava-integer-rotateright-method |
Java Method The compareUnsigned() is a method of Java Integer class which compares two integer objects numerically treating the values as unsigned. It returns the result of the value 0 if both arguments are equal; a value less than 0, if the first argument is...
3 min read
Java Method The toUnsignedLong() is a Java Integer class method which converts the argument to a long by an unsigned conversion. In an unsigned conversion to a long, the high-order 32 bits of the long are zero and the low-order 32 bits are equal to...
2 min read
Java Method The longValue() method is an instance method of Long class under java.lang package. This method returns the value of the specified long object as long equivalent. The longValue() method were inherited from the Number Class. Syntax: Following is the declaration of longValue() method: public int longValue() Parameter: DataType Parameter Description NA NA This...
2 min read
Java Method The min() is a method of Integer class under java.lang package. This method numerically returns the minimum value amongst the two method argument specified by a user. This method can be overloaded and it takes the arguments in int, double, float and long. Note:...
2 min read
Java method The decode() method is a static method of Integer class under java.lang package. The main function of this method is to decode a string which is written in the form of (" ") into an integer value. The decode() method also accepts decimal, hexadecimal,...
2 min read
Java Method The toBinaryString() method of Java Integer class returns a string representation of the integer argument as an unsigned integer in binary base 2. Note: If the argument is snegative, the unsigned integer value is the argument plus 232otherwise, it is equal to the argument....
2 min read
Java Method The signum() method of Java Integer class returns the signum function of the specified int value in the method argument. The signum function can be computed as: -1, if the specified number is negative. 0, if the specified number is zero. 1, if the specified number...
2 min read
Java Method The floatValue() method is a method of Integer class under java.lang package. This method returns the float equivalent value of this Integer object. The floatValue() method were specified from the Number Class. It may also involve in rounding or truncation of the Integer...
3 min read
Java Method The parseUnsignedInt() is a method of Java Integer class. There are three different types of parseUnsignedInt() method which can be differentiated depending on its parameter. These are: Java Integer parseUnsignedInt (String s) Method Java Integer parseUnsignedInt (String s, int radix) Method Java Integer parseUnsignedInt (CharSequence s, int...
5 min read
Java Method The hashCode() method is a Java Integer class method which returns the hash code for the given inputs. There are two different types of Java hashCode() method which can be differentiated depending on its parameter. These are: Java Method Java Integer hashCode(int value) Method hashCode()...
3 min read
We request you to subscribe our newsletter for upcoming updates.
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