public static boolean equals(byte[][] field1,byte[][] field2){
  int index1=0;
  int length1=field1 == null ? 0 : field1.length;
  int index2=0;
  int length2=field2 == null ? 0 : field2.length;
  while (true) {
    while (index1 < length1 && field1[index1] == null) {
      index1++;
    }
    while (index2 < length2 && field2[index2] == null) {
      index2++;
    }
    boolean atEndOf1=index1 >= length1;
    boolean atEndOf2=index2 >= length2;
    if (atEndOf1 && atEndOf2) {
      return true;
    }
 else     if (atEndOf1 != atEndOf2) {
      return false;
    }
 else     if (!Arrays.equals(field1[index1],field2[index2])) {
      return false;
    }
    index1++;
    index2++;
  }
}

public static boolean equals ( byte [ ] [ ] field1 , byte [ ] [ ] field2 ) { int index1 = 0 ; int length1 = field1 == null ? 0 : field1 . length ; int index2 = 0 ; int length2 = field2 == null ? 0 : field2 . length ; while ( true ) { while ( index1 < length1 && field1 [ index1 ] == null ) { index1 ++ ; } while ( index2 < length2 && field2 [ index2 ] == null ) { index2 ++ ; } boolean atEndOf1 = index1 >= length1 ; boolean atEndOf2 = index2 >= length2 ; if ( atEndOf1 && atEndOf2 ) { return true ; } else if ( atEndOf1 != atEndOf2 ) { return false ; } else if ( ! Arrays . equals ( field1 [ index1 ] , field2 [ index2 ] ) ) { return false ; } index1 ++ ; index2 ++ ; } }
checks repeated bytes field equality . only non - null elements are tested . returns true if the two fields have the same sequence of non - null elements . null - value fields and fields of any length with only null elements are considered equal .
