long l = 1000L; Long obj = Long.valueOf(l);
String str = "9999"; Long obj = Long.valueOf(str);
String hex = "0xff"; Long obj = Long.valueOf(hex, 16);In all the above examples, the Long.valueOf() method returns a Long object that represents the specified value. The Long object can be used to perform various operations on the long value, such as arithmetic operations, bitwise operations, and comparison operations. The Long class is part of the java.lang package, which is automatically imported into every Java program.