private boolean isNumberAndPunctuation(String string){
  int length=string.length();
  for (int i=0; i < length; ++i) {
    char c=string.charAt(i);
    if (!(Character.isDigit(c) || Characters.isPunctuation(c))) {
      return false;
    }
  }
  return true;
}

private boolean isNumberAndPunctuation ( String string ) { int length = string . length ( ) ; for ( int i = 0 ; i < length ; ++ i ) { char c = string . charAt ( i ) ; if ( ! ( Character . isDigit ( c ) || Characters . isPunctuation ( c ) ) ) { return false ; } } return true ; }
returns true if a strong consists entirely of digits and punctuation . false otherwise .
