private static int parseOctalMode(CharSequenceScanner parse) throws IllegalArgumentException {

    String octals = parse.readWhile(CharFilter.LATIN_DIGIT_FILTER);
    if (octals.length() == 0) {
      return -1;
    }
    if (octals.length() > 4) {
      throw new IllegalArgumentException();
    }
    return Integer.parseInt(octals, 8);
  }
private static int parseOctalMode ( CharSequenceScanner parse ) throws IllegalArgumentException { String octals = parse . readWhile ( CharFilter . LATIN_DIGIT_FILTER ) ; if ( octals . length ( ) == 0 ) { return - 1 ; } if ( octals . length ( ) > 4 ) { throw new IllegalArgumentException ( ) ; } return Integer . parseInt ( octals , 8 ) ; }
This method parses the current state of the {@link #chmod(String) chmod} argument given by {@code parse} in octal
mode. If no digits are detected, {@code parse} remains unchanged and {@code -1} is returned, else all digits are
consumed and the parsed octal-mode is returned.

@param parse is the current parser state of the the {@link #chmod(String) chmod} argument.
@return the parsed octal-mode or {@code -1} if {@code parse} does NOT point to a digit.
@throws IllegalArgumentException if there are more the 4 digits or non-octal digits (8 or 9).