MCPcopy Create free account
hub / github.com/zhuker/lamejs / convertByteArrayToFloat

Method convertByteArrayToFloat

src/main/java/lowlevel/LameEncoder.java:666–682  ·  view source on GitHub ↗
(byte bytes[], int offset, ByteOrder byteOrder)

Source from the content-addressed store, hash-verified

664 }
665
666 public final float convertByteArrayToFloat(byte bytes[], int offset, ByteOrder byteOrder)
667 {
668 byte byte0 = bytes[offset + 0];
669 byte byte1 = bytes[offset + 1];
670 byte byte2 = bytes[offset + 2];
671 byte byte3 = bytes[offset + 3];
672 int bits;
673 if (byteOrder == ByteOrder.BIG_ENDIAN) //big endian
674 {
675 bits = ((0xff & byte0) << 24) | ((0xff & byte1) << 16) | ((0xff & byte2) << 8) | ((0xff & byte3) << 0);
676 } else{
677 // little endian
678 bits = ((0xff & byte3) << 24) | ((0xff & byte2) << 16) | ((0xff & byte1) << 8) | ((0xff & byte0) << 0);
679 }
680 float result = Float.intBitsToFloat(bits);
681 return result;
682 }
683
684 public AudioFormat getSourceFormat() {
685 return sourceFormat;

Callers 1

doEncodeBufferMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected