code: 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;
    }
docs: 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.