private int digitCount(String text,int position,int amount){
  int limit=Math.min(text.length() - position,amount);
  amount=0;
  for (; limit > 0; limit--) {
    char c=text.charAt(position + amount);
    if (c < '0' || c > '9') {
      break;
    }
    amount++;
  }
  return amount;
}

private int digitCount ( String text , int position , int amount ) { int limit = Math . min ( text . length ( ) - position , amount ) ; amount = 0 ; for ( ; limit > 0 ; limit -- ) { char c = text . charAt ( position + amount ) ; if ( c < '0' || c > '9' ) { break ; } amount ++ ; } return amount ; }
returns actual amount of digits to parse , but no more than original ' amount ' parameter .
