public static int readIntME(InputStream stream) throws IOException, BufferUnderrunException {
        int ch1 = stream.read();
        int ch2 = stream.read();
        int ch3 = stream.read();
        int ch4 = stream.read();
        if ((ch1 | ch2 | ch3 | ch4) < 0) {
            throw new BufferUnderrunException();
        }
        return (ch2 << 24) + (ch1 << 16) + (ch4 << 8) + (ch3);
    }
@Test
    public void testReadIntME() throws Exception {
        // Example from https://yamm.finance/wiki/Endianness.html#mwAiw 
        byte[] data = new byte[]{(byte) 0x0b, (byte) 0x0a, (byte) 0x0d, (byte) 0x0c};
        assertEquals(0x0a0b0c0d, EndianUtils.readIntME(new ByteArrayInputStream(data)));

        data = new byte[]{(byte) 0xFE, (byte) 0xFF, (byte) 0xFC, (byte) 0xFD};
        assertEquals(0xfffefdfc, EndianUtils.readIntME(new ByteArrayInputStream(data)));

        data = new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
        try {
            EndianUtils.readIntME(new ByteArrayInputStream(data));
            fail("Should have thrown exception");
        } catch (EndianUtils.BufferUnderrunException e) {
            //swallow
        }
    }