code: public static boolean isNull(byte[] key, int length) {
          if (key == null) {
              return true;
          }
          for (int i = 0; i < Math.min(key.length, length); i++) {
              if (key[i] != 0) {
                  return false;
              }
          }
          return true;
      }
docs: Checks if the elements of the given key up the given length are 0, or the whole array is null.
  
  @param key
  @param length
  @return true, if the key is null or all elements in the array are 0.