code: public static boolean isWeak(byte[] key, int offset)
          throws InvalidKeyException {
          if (key == null) {
              throw new InvalidKeyException("null key");
          }
          if (key.length - offset < DES_KEY_LEN) {
              throw new InvalidKeyException("Wrong key size");
          }
          for (int i = 0; i < WEAK_KEYS.length; i++) {
              boolean found = true;
              for (int j = 0; j < DES_KEY_LEN && found == true; j++) {
                  if (WEAK_KEYS[i][j] != key[j+offset]) {
                      found = false;
                  }
              }
              if (found == true) {
                  return found;
              }
          }
          return false;
      }
docs: Checks if the given DES key material is weak or semi-weak.
  
  @param key the buffer with the DES key material.
  @param offset the offset in <code>key</code>, where the DES key
  material starts.
  
  @return true if the given DES key material is weak or semi-weak, false
  otherwise.
  
  @exception InvalidKeyException if the given key material is
  <code>null</code>, or starting at <code>offset</code> inclusive, is
  shorter than 8 bytes.