Example usage for java.lang Float floatToIntBits

List of usage examples for java.lang Float floatToIntBits

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static int floatToIntBits(float value) 

Source Link

Document

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout.

Usage

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

public JSONObject toJSONObject() {
    JSONObject obj = new JSONObject();
    obj.put("x", Float.floatToIntBits(x));
    obj.put("y", Float.floatToIntBits(y));
    return obj;// ww  w.j ava 2 s. c om
}

From source file:org.apache.mahout.common.RandomUtils.java

/** @return what {@link Float#hashCode()} would return for the same value */
public static int hashFloat(float value) {
    return Float.floatToIntBits(value);
}

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

public byte[] toByteArray() {
    byte[] x = BitUtils.convertIntToByteArray(Float.floatToIntBits(this.x));
    byte[] y = BitUtils.convertIntToByteArray(Float.floatToIntBits(this.y));
    return ArrayUtils.concatByteArrays(new byte[][] { x, y });
}

From source file:ByteConvert.java

public static final byte[] float2Byte(float[] inData) {
    int j = 0;//from   www  .ja  v a2 s .  c  o m
    int length = inData.length;
    byte[] outData = new byte[length * 4];
    for (int i = 0; i < length; i++) {
        int data = Float.floatToIntBits(inData[i]);
        outData[j++] = (byte) (data >>> 24);
        outData[j++] = (byte) (data >>> 16);
        outData[j++] = (byte) (data >>> 8);
        outData[j++] = (byte) (data >>> 0);
    }
    return outData;
}

From source file:de.uniwue.info2.numerics.prec.SinglePrecisionFloat.java

@Override
protected String floatValueToBinaryString(String value) {
    float f = Float.parseFloat(value);
    String binary;/*from   w  w w  .  j  a  va 2  s  . c  o  m*/
    if (f == 0) {
        binary = StringUtils.repeat("0", 32);
    } else {
        binary = Integer.toBinaryString(Float.floatToIntBits(f));
    }
    return binary;
}

From source file:com.github.mhendred.face4j.model.Point.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + Float.floatToIntBits(x);
    result = prime * result + Float.floatToIntBits(y);
    return result;
}

From source file:uk.co.modularaudio.mads.base.bandlimitedoscillator.ui.BandLimitedOscillatorMadUiInstance.java

public void sendFrequencyChange(final float frequency) {
    sendTemporalValueToInstance(BandLimitedOscillatorIOQueueBridge.COMMAND_FREQUENCY,
            (Float.floatToIntBits(frequency)));
}

From source file:com.norconex.collector.http.robot.RobotsTxt.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + Float.floatToIntBits(crawlDelay);
    result = prime * result + Arrays.hashCode(filters);
    result = prime * result + Arrays.hashCode(sitemapLocations);
    return result;
}

From source file:com.cloudera.oryx.rdf.common.rule.NumericPrediction.java

@Override
public int hashCode() {
    return Float.floatToIntBits(prediction);
}

From source file:uk.co.modularaudio.mads.base.bandlimitedoscillator.ui.BandLimitedOscillatorMadUiInstance.java

public void sendFrequencyChangeImmediate(final float frequency) {
    sendCommandValueToInstance(BandLimitedOscillatorIOQueueBridge.COMMAND_FREQUENCY_IMMEDIATE,
            (Float.floatToIntBits(frequency)));
}