private static boolean[] createSafeOctets(String safeChars){
  int maxChar='z';
  char[] safeCharArray=safeChars.toCharArray();
  for (  char c : safeCharArray) {
    maxChar=Math.max(c,maxChar);
  }
  boolean[] octets=new boolean[maxChar + 1];
  for (int c='0'; c <= '9'; c++) {
    octets[c]=true;
  }
  for (int c='A'; c <= 'Z'; c++) {
    octets[c]=true;
  }
  for (int c='a'; c <= 'z'; c++) {
    octets[c]=true;
  }
  for (  char c : safeCharArray) {
    octets[c]=true;
  }
  return octets;
}

private static boolean [ ] createSafeOctets ( String safeChars ) { int maxChar = 'z' ; char [ ] safeCharArray = safeChars . toCharArray ( ) ; for ( char c : safeCharArray ) { maxChar = Math . max ( c , maxChar ) ; } boolean [ ] octets = new boolean [ maxChar + 1 ] ; for ( int c = '0' ; c <= '9' ; c ++ ) { octets [ c ] = true ; } for ( int c = 'A' ; c <= 'Z' ; c ++ ) { octets [ c ] = true ; } for ( int c = 'a' ; c <= 'z' ; c ++ ) { octets [ c ] = true ; } for ( char c : safeCharArray ) { octets [ c ] = true ; } return octets ; }
creates a boolean [ ] with entries corresponding to the character values for 0 - 9 , a - z , a - z and those specified in safechars set to true . the array is as small as is required to hold the given character information .
