CharScanner { public static int parseInt( char[] digitChars ) { return parseInt(digitChars, 0, digitChars.length); }  static boolean isDigit( int c ); static boolean isDecimalDigit( int c ); static boolean isDecimalChar( int currentChar ); static boolean hasDecimalChar( char[] chars, boolean negative ); static boolean isDigits( final char[] inputArray ); static boolean isDigits( final char[] inputArray, int offset, int len); static char[][] splitExact( final char[] inputArray,
                                       final char split, final int resultsArrayLength ); static char[][] splitExact( final char[] inputArray,
                                       final int resultsArrayLength, char... delims ); static char[][] splitLines( final char[] inputArray); static char[][] split( final char[] inputArray,
                                  final char split ); static char[][] splitFrom( final char[] inputArray,
                                  final char split, int from ); static char[][] split( final char[] inputArray,
                                  final char split, final int limit ); static char[][] splitFromStartWithLimit( final char[] inputArray,
                                  final char split, final int start,
                                  final int limit ); static char[][] splitByChars( final char[] inputArray,
                                         final char... delims ); static char[][] splitByCharsFromToDelims( final char[] inputArray, int from, int to,
                                                     final char... delims ); static char[][] splitByCharsNoneEmpty( final char[] inputArray,
                                                  final char... delims ); static char[][] splitByCharsNoneEmpty( final char[] inputArray, int from, int to,
                                                  final char... delims ); static char[][] compact( char[][] array ); static boolean isLong( char[] digitChars ); static boolean isLong( char[] digitChars, int offset, int len ); static boolean isInteger( char[] digitChars ); static boolean isInteger( char[] digitChars, int offset, int len); static int parseInt( char[] digitChars ); static int parseInt(char[] digitChars, int offset, int to); static int parseIntFromToIgnoreDot( char[] digitChars, int offset, int to ); static long parseLongFromToIgnoreDot( char[] digitChars, int offset, int to ); static long parseLong(char[] digitChars, int offset, int to); static long parseLong( char[] digitChars ); static Number parseJsonNumber( char[] buffer ); static Number parseJsonNumber( char[] buffer, int from, int to ); static final boolean isNumberDigit(int c); static boolean isDelimiter( int c ); static Number parseJsonNumber( char[] buffer, int from, int max, int size[] ); static float parseFloat( char[] buffer, int from, int to ); static float parseFloat( char[] buffer ); static double parseDouble( char[] buffer ); static double parseDouble( char[] buffer, int from, int to ); static int skipWhiteSpace( char [] array); static int skipWhiteSpace( char [] array, int index ); static int skipWhiteSpace( char [] array, int index, final int length ); static char[] readNumber( char[] array, int idx ); static char[] readNumber( char[] array, int idx, final int len ); static int skipWhiteSpaceFast( char [] array ); static int skipWhiteSpaceFast( char [] array, int index ); static String errorDetails( String message, char[] array, int index, int ch ); static String debugCharDescription( int c ); static final boolean isDoubleQuote( int c ); static final boolean isEscape( int c ); static boolean hasEscapeChar(char []array, int index, int[] indexHolder); static int findEndQuote(final char[] array,  int index); static char[][] splitComma(char[] inputArray); static char[][] splitBySpace( char[] inputArray); static char[][] splitByChar(int splitChar, char[] inputArray); static int findChar(char c, char[] line); static int findWhiteSpace(char[] line); static int findWhiteSpace( int start, char[] line); static int findChar(char c, int startIndex, char[] line); static int findString(String matchString, int startIndex, char[] line); static int findString(String matchString, char[] line); static int findChars(char[] matchChars, char[] line); static boolean matchChars(char[] matchChars, int startIndex, char[] line); static int findChars(char[] matchChars, int startIndex, char[] line); static char[][] splitByPipe(char[] inputArray); static int NEWLINE; static int CARRIAGE_RETURN; }
@Test public void parseInt() { int i = CharScanner.parseInt( "-22".toCharArray() ); boolean ok = i == -22 || die( "" + i); i = CharScanner.parseInt( "22".toCharArray() ); ok = i == 22 || die( "" + i); }
@Test public void parseIntMax() { boolean ok = true; int i = 0; i = CharScanner.parseInt( ("" + Integer.MAX_VALUE).toCharArray() ); ok &= i == Integer.MAX_VALUE || die( "i", i, "MAX", Integer.MAX_VALUE); }
@Test public void parseIntMin() { boolean ok = true; int i = 0; i = CharScanner.parseInt( ("" + Integer.MIN_VALUE).toCharArray() ); ok &= i == Integer.MIN_VALUE || die( "i", i, "MIN", Integer.MIN_VALUE); }