Example usage for java.lang Float intBitsToFloat

List of usage examples for java.lang Float intBitsToFloat

Introduction

In this page you can find the example usage for java.lang Float intBitsToFloat.

Prototype

@HotSpotIntrinsicCandidate
public static native float intBitsToFloat(int bits);

Source Link

Document

Returns the float value corresponding to a given bit representation.

Usage

From source file:Main.java

/**
 * Reads a "float" value from an InputStream. The value is
 * converted to the opposed endian system while reading.
 * @param input source InputStream/*w w  w  .  j a  va  2 s .  co  m*/
 * @return the value just read
 * @throws IOException in case of an I/O problem
 */
public static float readSwappedFloat(InputStream input) throws IOException {
    return Float.intBitsToFloat(readSwappedInteger(input));
}

From source file:Main.java

public static float bytesToFloatLE(byte[] bytes, int off) {
    return Float.intBitsToFloat(bytesToIntLE(bytes, off));
}

From source file:Main.java

public static float bytesToFloatBE(byte[] bytes, int off) {
    return Float.intBitsToFloat(bytesToIntBE(bytes, off));
}

From source file:Main.java

public static float bytesLE2float(byte[] b, int off) {
    return Float.intBitsToFloat(bytesLE2int(b, off));
}

From source file:Main.java

public static float bytesBE2float(byte[] b, int off) {
    return Float.intBitsToFloat(bytesBE2int(b, off));
}

From source file:halive.shootinoutside.common.util.Vector2D.java

private void deserialize(byte[] b) {
    int iX = BitUtils.convertByteArrayToInt(b, 0);
    int iY = BitUtils.convertByteArrayToInt(b, 4);

    setPos(Float.intBitsToFloat(iX), Float.intBitsToFloat(iY));
}

From source file:uk.co.modularaudio.mads.base.scaleandoffset.mu.ScaleAndOffsetIOQueueBridge.java

@Override
public void receiveQueuedEventsToInstance(final ScaleAndOffsetMadInstance instance,
        final ThreadSpecificTemporaryEventStorage tses, final long periodTimestamp,
        final IOQueueEvent queueEntry) {
    switch (queueEntry.command) {
    case COMMAND_IN_SCALE: {
        final long val = queueEntry.value;
        final float f = Float.intBitsToFloat((int) val);
        instance.desiredScaleValue = f;/* w  w w  . j av a2s . c o m*/
        break;
    }
    case COMMAND_IN_OFFSET: {
        final long val = queueEntry.value;
        final float f = Float.intBitsToFloat((int) val);
        instance.desiredOffsetValue = f;
        break;
    }
    default: {
        final String msg = "Unknown command: " + queueEntry.command;
        log.error(msg);
    }
    }
}

From source file:uk.co.modularaudio.mads.base.staticvalue.mu.StaticValueIOQueueBridge.java

@Override
public void receiveQueuedEventsToInstance(final StaticValueMadInstance instance,
        final ThreadSpecificTemporaryEventStorage tses, final long periodTimestamp,
        final IOQueueEvent queueEntry) {
    switch (queueEntry.command) {
    case COMMAND_VALUE: {
        // Is just a float
        final long longValue = queueEntry.value;
        final int truncVal = (int) longValue;
        final float value = Float.intBitsToFloat(truncVal);
        instance.currentValue = value;/* w  ww.  ja  v  a  2  s.c  o m*/
        break;
    }
    default: {
        final String msg = "Unknown command passed on incoming queue: " + queueEntry.command;
        log.error(msg);
    }
    }
}

From source file:uk.co.modularaudio.mads.base.crossfader.mu.CrossFaderIOQueueBridge.java

@Override
public void receiveQueuedEventsToInstance(final CrossFaderMadInstance instance,
        final ThreadSpecificTemporaryEventStorage tses, final long periodTimestamp,
        final IOQueueEvent queueEntry) {
    switch (queueEntry.command) {
    case COMMAND_AMPA_AMPB: {
        final long value = queueEntry.value;
        final int lower32Bits = (int) ((value) & 0xFFFFFFFF);
        final int upper32Bits = (int) ((value >> 32) & 0xFFFFFFFF);
        final float ampA = Float.intBitsToFloat(lower32Bits);
        final float ampB = Float.intBitsToFloat(upper32Bits);
        instance.setDesiredAmps(ampA, ampB);
        break;/*from www  .  j a v  a  2  s. c o m*/
    }
    default: {
        final String msg = "Unknown command passed on incoming queue: " + queueEntry.command;
        log.error(msg);
    }
    }
}

From source file:uk.co.modularaudio.mads.base.limiter.mu.LimiterIOQueueBridge.java

@Override
public void receiveQueuedEventsToInstance(final LimiterMadInstance instance,
        final ThreadSpecificTemporaryEventStorage tses, final long periodTimestamp,
        final IOQueueEvent queueEntry) {
    switch (queueEntry.command) {
    case COMMAND_KNEE: {
        // Is just a float
        final long value = queueEntry.value;
        final int truncVal = (int) value;
        final float kn = Float.intBitsToFloat(truncVal);
        instance.setKnee(kn);/*from   www .  j  av  a  2 s  .c  o m*/
        break;
    }
    case COMMAND_FALLOFF: {
        // Is just a float
        final long value = queueEntry.value;
        final int truncVal = (int) value;
        final float f = Float.intBitsToFloat(truncVal);
        instance.setFalloff(f);
        break;
    }
    case COMMAND_USE_HARD_LIMIT: {
        final boolean useHardLimit = queueEntry.value == 1;
        instance.setUseHardLimit(useHardLimit);
        break;
    }
    default: {
        final String msg = "Unknown command passed on incoming queue: " + queueEntry.command;
        log.error(msg);
    }
    }
}