public static int compareTo(byte[] lhs, byte[] rhs) {
        if (lhs == rhs) {
            return 0;
        }
        if (lhs == null) {
            return -1;
        }
        if (rhs == null) {
            return +1;
        }
        if (lhs.length != rhs.length) {
            return ((lhs.length < rhs.length) ? -1 : +1);
        }
        for (int i = 0; i < lhs.length; i++) {
            if (lhs[i] < rhs[i]) {
                return -1;
            } else if (lhs[i] > rhs[i]) {
                return 1;
            }
        }
        return 0;
    }