Class Utils


  • public final class Utils
    extends java.lang.Object
    Serialization utilities.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean arrayContains​(char[] array, char element)
      Checks if an array contains the specified element.
      static int arrayIndexOf​(char[] array, char element)
      Returns the index, within the specified array, of the first occurrence of the specified character.
      static double parseDouble​(CharsWrapper chars)
      Parses a CharsWrapper that represents a double value.
      static int parseInt​(CharsWrapper chars, int base)
      Parses a CharsWrapper that represents an int value in the specified base.
      static long parseLong​(CharsWrapper chars, int base)
      Parses a CharsWrapper that represents a long value in the specified base.
      • Methods inherited from class java.lang.Object

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

      • arrayContains

        public static boolean arrayContains​(char[] array,
                                            char element)
        Checks if an array contains the specified element.
        Parameters:
        array - the array
        element - the element to search
        Returns:
        true if the array contains the element, false if it doesn't
      • arrayIndexOf

        public static int arrayIndexOf​(char[] array,
                                       char element)
        Returns the index, within the specified array, of the first occurrence of the specified character. Returns -1 if the array doesn't contains the character.
        Parameters:
        array - the array
        element - the element to search
        Returns:
        the index of the first occurence of c, or -1 if not found.
      • parseLong

        public static long parseLong​(CharsWrapper chars,
                                     int base)
        Parses a CharsWrapper that represents a long value in the specified base.
        Parameters:
        chars - the CharsWrapper representing a long
        base - the base of the number
        Returns:
        the long value represented by the CharsWrapper
      • parseInt

        public static int parseInt​(CharsWrapper chars,
                                   int base)
        Parses a CharsWrapper that represents an int value in the specified base.
        Parameters:
        chars - the CharsWrapper representing an int
        base - the base of the number
        Returns:
        the int value represented by the CharsWrapper
      • parseDouble

        public static double parseDouble​(CharsWrapper chars)
        Parses a CharsWrapper that represents a double value.
        Parameters:
        chars - the CharsWrapper representing a double
        Returns:
        the double value represented by the CharsWrapper