Class Numbers


  • public final class Numbers
    extends java.lang.Object
    Utility methods related to Number.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int parseUnsignedInt​(java.lang.String s, int radix)
      Counterpart of Integer.parseInt(String, int) for parsing unsigned integers.
      static long parseUnsignedLong​(java.lang.String s, int radix)
      Counterpart of Long.parseLong(String, int) for parsing unsigned integers.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • parseUnsignedInt

        public static int parseUnsignedInt​(@Nullable
                                           java.lang.String s,
                                           int radix)
                                    throws java.lang.NumberFormatException
        Counterpart of Integer.parseInt(String, int) for parsing unsigned integers.

        Redundant with java.lang.Integer.parseUnsignedInt(String, int radix), which is available since Java 8.

        Returns:
        0 through 232 - 1
        Throws:
        java.lang.NumberFormatException - s is null or empty
        java.lang.NumberFormatException - radix is out of range (see Character.digit(char, int))
        java.lang.NumberFormatException - The value represented by s is larger than 232 - 1
        java.lang.NumberFormatException - s contains characters that are not valid digits for the given radix (see Character.digit(char, int))
      • parseUnsignedLong

        public static long parseUnsignedLong​(@Nullable
                                             java.lang.String s,
                                             int radix)
                                      throws java.lang.NumberFormatException
        Counterpart of Long.parseLong(String, int) for parsing unsigned integers.

        Redundant with java.lang.Long.parseUnsignedLong(String, int radix), which is available since Java 8.

        Returns:
        0 through 264 - 1
        Throws:
        java.lang.NumberFormatException - s is null or empty
        java.lang.NumberFormatException - radix is out of range (see Character.digit(char, int))
        java.lang.NumberFormatException - The value represented by s is larger than 264 - 1
        java.lang.NumberFormatException - s contains characters that are not valid digits for the given radix (see Character.digit(char, int))