public boolean isNumericalRun(String pin){
  final int len=pin.length();
  int prevDigit=Character.digit(pin.charAt(0),10);
  int prevDiff=Integer.MAX_VALUE;
  boolean isRun=true;
  for (int i=1; isRun && i < len; i++) {
    final int digit=Character.digit(pin.charAt(i),10);
    final int diff=digit - prevDigit;
    if (prevDiff != Integer.MAX_VALUE && diff != prevDiff) {
      isRun=false;
    }
    prevDiff=diff;
    prevDigit=digit;
  }
  return isRun;
}

public boolean isNumericalRun ( String pin ) { final int len = pin . length ( ) ; int prevDigit = Character . digit ( pin . charAt ( 0 ) , 10 ) ; int prevDiff = Integer . MAX_VALUE ; boolean isRun = true ; for ( int i = 1 ; isRun && i < len ; i ++ ) { final int digit = Character . digit ( pin . charAt ( i ) , 10 ) ; final int diff = digit - prevDigit ; if ( prevDiff != Integer . MAX_VALUE && diff != prevDiff ) { isRun = false ; } prevDiff = diff ; prevDigit = digit ; } return isRun ; }
tests the string to see if it contains a numeric run . for example , " 123456 " , " 0000 " , " 9876 " , and " 2468 " would all match .
