Here you can find the source of memcmp(byte[] a, byte[] b)
private static int memcmp(byte[] a, byte[] b)
//package com.java2s; /*//from w ww .j a va2 s.co m * Copyright (c) 2013 ICM Uniwersytet Warszawski All rights reserved. * See LICENCE.txt file for licensing information. */ public class Main { private static int memcmp(byte[] a, byte[] b) { int min = a.length > b.length ? b.length : a.length; for (int i = 0; i < min; i++) if (a[i] < b[i]) return -1; else if (a[i] > b[i]) return 1; return a.length - b.length; } }