cdm/src/main/java/ucar/nc2/util/Misc.java
static public boolean compare(byte[] raw1, byte[] raw2, Formatter f) {
    if (raw1 == null || raw2 == null) return false;

    if (raw1.length != raw2.length) {
      f.format("length 1= %3d != length 2=%3d%n", raw1.length, raw2.length);
    }
    int len = Math.min(raw1.length, raw2.length);

    int ndiff = 0;
    for (int i = 0; i < len; i++) {
      if (raw1[i] != raw2[i]) {
        f.format(" %3d : %3d != %3d%n", i + 1, raw1[i], raw2[i]);
        ndiff++;
      }
    }
    f.format("tested %d bytes  diff = %d %n", len, ndiff);
    return ndiff == 0 && (raw1.length == raw2.length);
  }
static public boolean compare(byte[] raw1, byte[] raw2, Formatter f) {
    if (raw1 == null || raw2 == null) return false;

    if (raw1.length != raw2.length) {
      f.format("length 1= %3d != length 2=%3d%n", raw1.length, raw2.length);
    }
    int len = Math.min(raw1.length, raw2.length);

    int ndiff = 0;
    for (int i = 0; i < len; i++) {
      if (raw1[i] != raw2[i]) {
        f.format(" %3d : %3d != %3d%n", i + 1, raw1[i], raw2[i]);
        ndiff++;
      }
    }
    f.format("tested %d bytes  diff = %d %n", len, ndiff);
    return ndiff == 0 && (raw1.length == raw2.length);
  }
static public boolean compare ( byte [ ] raw1 , byte [ ] raw2 , Formatter f ) { if ( raw1 == null || raw2 == null ) return false ; if ( raw1 . length != raw2 . length ) { f . format ( "length 1= %3d != length 2=%3d%n" , raw1 . length , raw2 . length ) ; } int len = Math . min ( raw1 . length , raw2 . length ) ; int ndiff = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( raw1 [ i ] != raw2 [ i ] ) { f . format ( " %3d : %3d != %3d%n" , i + 1 , raw1 [ i ] , raw2 [ i ] ) ; ndiff ++ ; } } f . format ( "tested %d bytes  diff = %d %n" , len , ndiff ) ; return ndiff == 0 && ( raw1 . length == raw2 . length ) ; }
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////