Javatpoint Logo
Javatpoint Logo

Java Integer toUnsignedLong() 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 the bits of the integer argument.


Following is the declaration of toUnsignedLong() method:


DataType Parameter Description Required/Optional
int i It is a value which is used to convert to an unsigned long. Required


The toUnsignedLong() method returns the argument converted to long by an unsigned conversion.



Compatibility Version:

Java 1.8 and above

Example 1

Test it Now


Unsigned x1  = 4294967291
Unsigned x2  = 5
Unsigned y1  = 4294967290
Unsigned y2  = 6

Example 2


Enter a value to perform unsigned operation: 32435
Output: 32435

Example 3


Input value to perform unsigned operation: -GSDJD
Exception in thread "main" java.util.InputMismatchException
	at java.base/java.util.Scanner.throwFor(
	at java.base/
	at java.base/java.util.Scanner.nextInt(
	at java.base/java.util.Scanner.nextInt(
	at myPackage.IntegerToUnsignedLongExample3.main(

Next TopicvalueOf() Method

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA