Java Binary Convert to binaryStringToFloat(String value)

Here you can find the source of binaryStringToFloat(String value)

Description

binary String To Float

License

MIT License

Declaration

public static float binaryStringToFloat(String value) 

Method Source Code

//package com.java2s;
/**/*from   w  ww .  j a  v  a2  s  .  c o m*/
 * Copyright (c) 2014 Sa?l Pi?a <sauljabin@gmail.com>.
 * 
 * This file is part of GeneticAlgorithm.
 * 
 * GeneticAlgorithm is licensed under The MIT License.
 * For full copyright and license information please see the LICENSE file.
 */

public class Main {
    public static float binaryStringToFloat(String value) {
        return (value.charAt(0) == '1' ? -1f : 1f)
                * Float.intBitsToFloat(Integer.parseInt(value.substring(1),
                        2));
    }
}

Related

  1. binaryString(byte aByte, boolean prefix)
  2. binaryString2ByteArr(String binary)
  3. binaryString2Long(String binString)
  4. binaryStringToBytes(String binaryString)