long num1 = 117; String hexString = Long.toHexString(num1); System.out.println("Hexadecimal representation of " + num1 + " is: " + hexString);
Hexadecimal representation of 117 is: 75
Long num2 = -2147483648L; String hexString = Long.toHexString(num2); System.out.println("Hexadecimal representation of " + num2 + " is: " + hexString);
Hexadecimal representation of -2147483648 is: 80000000In both examples, we are converting Long numbers to their hexadecimal representation using the toHexString() method provided by the java.util Long class. The java.util Long class is part of the Java standard library, which is included in the java.util package.