I'm trying to extract 6 bytes from a byte array and convert them into a 48 bit signed integer value (I. E. a Java long). How can this be accomplished?
Edit: For example, if a byte array has one of the following:
byte[] minInt48 = new byte[] { (byte)0x80, 0, 0, 0, 0, 0 };
byte[] maxInt48 = new byte[] { (byte)0x7F, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF };
How can I parse this into a Java primitive (i.e. Java long) such that the sign value is preserved?