Java Integer toUnsignedLong() MethodThe 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. Syntax:Following is the declaration of toUnsignedLong() method: Parameter:
Returns:The toUnsignedLong() method returns the argument converted to long by an unsigned conversion. Exceptions:NA Compatibility Version:Java 1.8 and above Example 1Output: Unsigned x1 = 4294967291 Unsigned x2 = 5 Unsigned y1 = 4294967290 Unsigned y2 = 6 Example 2Output: Enter a value to perform unsigned operation: 32435 Output: 32435 Example 3Output: Input value to perform unsigned operation: -GSDJD Exception in thread "main" java.util.InputMismatchException at java.base/java.util.Scanner.throwFor(Scanner.java:939) at java.base/java.util.Scanner.next(Scanner.java:1594) at java.base/java.util.Scanner.nextInt(Scanner.java:2258) at java.base/java.util.Scanner.nextInt(Scanner.java:2212) at myPackage.IntegerToUnsignedLongExample3.main(IntegerToUnsignedLongExample3.java:8) Next TopicJava-integer-tounsignedstring-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