ByteUtils { public static int indexOf(byte[] array, byte needle, int offset, int maxLength) { int result = -1; maxLength = Math.min(offset + maxLength, array.length); for(int i = offset; i < maxLength; i++) { if(array[i] == needle) { result = i; break; } } return result; }  static boolean allEquals(byte[] array, byte value, int offset, int maxLength); static int indexOf(byte[] array, byte needle, int offset, int maxLength); static byte[] trim(byte[] src, byte padding, boolean right, int minLength); static byte[] toByteArray(InputStream inputStream);  }
@Test public void testIndexOf() throws Exception { }