Java Integer toUnsignedString() Method25 Mar 2025 | 3 min read This method is used to get an unsigned String object representing the value of the Number Object. There is two different types of Java toUnsignedString() method which can be differentiated depending on its parameter. These are:
1. Java Integer toUnsignedString(int i) MethodThe toUnsignedString(int i) is an inbuilt method of Java which is used to return a string representation of the argument as an unsigned decimal value. 2. Java Integer toUnsignedString(int i, int radix) MethodThis method returns a string representation of the first int type argument as an unsigned integer value in the radix specified by the second argument. If the radix is smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX then the base 10 is used. In this method, the following ASCII characters are used as digits: 0 to 9 and a to z. Note: Here, the first argument is treated as an unsigned value so, there is no leading sign character will be printed.Syntax:Following is the declarations of toUnsignedString() method: Parameter:
Returns:
Exceptions:NA Compatibility Version:Java 1.8 and above Example 1Output: String Representation = 25 String Representation = 4294967278 Example 2Output: Enter Value: ABCD 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.IntegerToUnsignedStringExample2.main(IntegerToUnsignedStringExample2.java:9) Example 3Output: String Value = 4294967231 String Value = 41 String Value = ffffffbf String Value = 1000001 String Value = 11111111111111111111111110111111 Example 4Output: Enter Number: -37245327 Enter Radix/Base: 16 Output: fdc7ae71 Next TopicJava-identityhashmap-values-method |
Java method The decode() method is a static method of Integer class under java.lang package. The main function of this method is to decode a string which is written in the form of (" ") into an integer value. The decode() method also accepts decimal, hexadecimal,...
2 min read
Java Method The parseUnsignedInt() is a method of Java Integer class. There are three different types of parseUnsignedInt() method which can be differentiated depending on its parameter. These are: Java Integer parseUnsignedInt (String s) Method Java Integer parseUnsignedInt (String s, int radix) Method Java Integer parseUnsignedInt (CharSequence s, int...
5 min read
Java Method The compareUnsigned() is a method of Java Integer class which compares two integer objects numerically treating the values as unsigned. It returns the result of the value 0 if both arguments are equal; a value less than 0, if the first argument is...
3 min read
Java Method The intValue() method is an instance method of Integer class under java.lang package. This method returns the value of the specified number as an int. It is inherited from the Number Class. Syntax: Following is the declaration of intValue() method: public int intValue() Parameter: DataType Parameter Description NA NA This method does not...
2 min read
Java method The bitCount() is a method of Integer class under java.lang package. It returns the number of one-bits in the two's complement binary representation of the specified int value. This function is sometimes referred to as the population count. Syntax Following is the declaration of bitCount()...
2 min read
Java method The compareTo() method is a method of Integer class under java.lang package. This method compares two integer objects numerically. It returns the result of the value 0 if Integer is equal to the argument Integer, a value less than 0 if Integer is...
2 min read
Java Method The shortValue() method of Java Integer class returns the value of this Integer as a short type after a primitive conversion. It overrides the shortValue() method of Number Class. Syntax: Following is the declaration of shortValue() method: public static int shortValue() Parameter: DataType Parameter Description NA NA This method does not take any...
2 min read
Java Method The numberOfTrailingZeros() method is a method of Integer class under java.lang package. This method returns the total number of zero bits following the lowest-order ("rightmost") one's-bit in the two's complement binary representation of the specified integer value i.e. it converts int value to...
2 min read
Java Method The min() is a method of Integer class under java.lang package. This method numerically returns the minimum value amongst the two method argument specified by a user. This method can be overloaded and it takes the arguments in int, double, float and long. Note:...
2 min read
Java Method The sum() method of Java Integer class numerically returns the sum of its arguments specified by a user. This method adds two integers together as per the + operator. It can be overloaded and accepts the arguments in int, double, float and long. Note:...
2 min read
We request you to subscribe our newsletter for upcoming updates.
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