Java Long.toHexString() Method Last Updated : 05 Dec, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The Java.lang.Long.toHexString() is a built-in function in Java which returns a string representation of the long argument as an unsigned integer in base 16. The function accepts a single parameter as an argument in Long data-type. Syntax: public static String toHexString(long num) Parameters: The function accepts a single mandatory parameter num - This parameter specifies the number which is to be converted to Hexadecimal string. Return Value: The function returns a string representation of the long argument as an unsigned integer in base 16. Examples: Input : 11 Output : b Input : 12 Output : c Program 1: The program below demonstrates the working of function. Java // Java program to demonstrate working // of java.lang.Long.toHexString() method import java.lang.Math; class Gfg1 { // driver code public static void main(String args[]) { long l = 11; // returns the string representation of the unsigned int value // represented by the argument in binary (base 2) System.out.println("Hex string is " + Long.toHexString(l)); } } Output: Hex string is b Program 2: The program below demonstrates the working of function. Java // Java program to demonstrate working // of java.lang.Long.toHexString() method import java.lang.Math; class Gfg1 { // driver code public static void main(String args[]) { long l = 234; // returns the string representation of the unsigned int value // represented by the argument in binary (base 2) System.out.println("Hex string is " + Long.toHexString(l)); } } Output: Hex string is ea Comment More infoAdvertise with us Next Article Object toString() Method in Java G gopaldave Follow Improve Article Tags : Java Java-lang package Java-Functions java-Long Practice Tags : Java Similar Reads JavaTuples toString() method The toString() method in org.javatuples is used to convert the values in TupleClass into a String. This method is inherited from the JavaTuple class. This method can be used to any tuple class object of javatuples library. It returns a String value formed with the values in the TupleClassObject. Met 2 min read MathContext toString() Method in Java The MathContext.toString() method in Java is a part of java.math package. This method is used to define the precision and rounding behaviour for BigDecimal operations. This method returns the string representation of a MathContext object's context settings. The string returned represents the setting 2 min read Java String trim() Method The trim() method of the String class in Java is used to remove leading and trailing whitespace from a string. The Unicode value of the space character is "\u0020". It does not remove any whitespace in the middle of the string. This method returns a new string with the whitespace removed and leaves 4 min read Object toString() Method in Java Object class is present in java.lang package. Every class in Java is directly or indirectly derived from the Object class, henceforth, it is a child of the Object class. If a class does not extend any other class then it is a direct child class of Object, and if it extends another class, then it is 3 min read Java lang Integer.toHexString() Method with Examples The Java.lang.Integer.toHexString() is a built-in function in Java which returns a string representation of the integer argument as an unsigned integer in base 16. The function accepts a single parameter as an argument in Integer data-type. Syntax : public static String toHexString(int num) Paramete 3 min read Boolean toString() Method in Java In Java, the toString() method of the Boolean class is a built-in method to return the Boolean value in string format. The Boolean class is a part of java.lang package. This method is useful when we want the output in the string format in places like text fields, console output, or simple text forma 2 min read Like