diff --git a/src/zutil/ByteUtil.java b/src/zutil/ByteUtil.java index ce40587..aad21cf 100755 --- a/src/zutil/ByteUtil.java +++ b/src/zutil/ByteUtil.java @@ -95,6 +95,21 @@ public class ByteUtil { return dest; } + /** + * Creates a new byte array with reversed byte ordering + * (LittleEndian -> BigEndian, BigEndian -> LittleEndian) + * + * @param data is the byte array that will be reversed. + * @return a new byte array that will have the same data but in reverse byte order + */ + public static byte[] getReverseByteOrder(byte[] data){ + byte[] dest = new byte[data.length]; + if (data.length > 0) + for (int i=0; i