static int compareTo(final byte[] b1,final int offset1,final int length1,final byte[] b2,final int offset2,final int length2){
  int count=Math.min(length1,length2);
  int i=offset1;
  int j=offset2;
  while (count-- != 0) {
    final int firstByte=0xFF & b1[i++];
    final int secondByte=0xFF & b2[j++];
    if (firstByte != secondByte) {
      return firstByte - secondByte;
    }
  }
  return length1 - length2;
}

static int compareTo ( final byte [ ] b1 , final int offset1 , final int length1 , final byte [ ] b2 , final int offset2 , final int length2 ) { int count = Math . min ( length1 , length2 ) ; int i = offset1 ; int j = offset2 ; while ( count -- != 0 ) { final int firstByte = 0xFF & b1 [ i ++ ] ; final int secondByte = 0xFF & b2 [ j ++ ] ; if ( firstByte != secondByte ) { return firstByte - secondByte ; } } return length1 - length2 ; }
compares two byte array sub - sequences and returns a value that indicates their relative order .
