class ByteUtil {

	public static byte[] stripLeadingZeroes(byte[] data) {

		if (data == null)
			return null;

		int firstNonZero = 0;
		int i = 0;
		for (; i < data.length; ++i) {
			if (data[i] != 0) {
				firstNonZero = i;
				break;
			}
		}
		if (i == data.length)
			return new byte[1];
		if (firstNonZero == 0)
			return data;

		byte[] result = new byte[data.length - firstNonZero];
		System.arraycopy(data, firstNonZero, result, 0, data.length - firstNonZero);

		return result;
	}

}