Here you can find the source of get24BitInt(byte b1, byte b2, byte b3, ByteOrder order)
Parameter | Description |
---|---|
b1 | top byte |
b2 | mid byte |
b3 | low byte |
order | the byte order |
private static final int get24BitInt(byte b1, byte b2, byte b3, ByteOrder order)
//package com.java2s; import java.nio.ByteOrder; public class Main { /**//from w w w . j ava2 s .c o m * Returns an integer for the given 3 bytes. * @param b1 top byte * @param b2 mid byte * @param b3 low byte * @param order the byte order * @return int */ private static final int get24BitInt(byte b1, byte b2, byte b3, ByteOrder order) { if (order == ByteOrder.BIG_ENDIAN) { return ((b1 << 16) | ((b2 & 0xFF) << 8) | (b3 & 0xFF)); } else { return ((b3 << 16) | ((b2 & 0xFF) << 8) | (b1 & 0xFF)); } } }