Example usage for java.lang Float toString

List of usage examples for java.lang Float toString

Introduction

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

Prototype

public static String toString(float f) 

Source Link

Document

Returns a string representation of the float argument.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {

    String str = Float.toString(0.3F);
}

From source file:Main.java

public static void main(String[] args) {
    Float floatObject2 = Float.valueOf(1.1F);
    System.out.println(Float.toString(floatObject2));

}

From source file:Main.java

public static void main(String[] args) throws Exception {
    long startTime = System.currentTimeMillis();

    for (int i = 0; i < 10; i++) {
        Thread.sleep(60);//from   w w w.ja v  a 2s.  c  o m
    }
    long endTime = System.currentTimeMillis();
    float seconds = (endTime - startTime) / 1000F;
    System.out.println(Float.toString(seconds) + " seconds.");
}

From source file:Main.java

public static String convertFloatToString(float f) {
    if (f - (int) f == 0.0) {
        return Float.toString(f).split("\\.")[0];
    } else {// w w  w .  j  a va2s  . co  m
        return Float.toString(f);
    }
}

From source file:Main.java

public static String FloatToString_JAVA(float number) {
    return Float.toString(number);
}

From source file:Main.java

public static float subFloat(Float v1, Float v2) {
    BigDecimal b1 = new BigDecimal(Float.toString(v1));
    BigDecimal b2 = new BigDecimal(Float.toString(v2));
    return b1.subtract(b2).floatValue();
}

From source file:Main.java

public static float round(float d, int decimalPlace) {
    BigDecimal bd = new BigDecimal(Float.toString(d));
    bd = bd.setScale(decimalPlace, BigDecimal.ROUND_HALF_UP);
    return bd.floatValue();
}

From source file:Main.java

public static float round(float d, int decimalPlace) {
    BigDecimal bd = new BigDecimal(Float.toString(d));
    bd = bd.setScale(decimalPlace, BigDecimal.ROUND_FLOOR);
    return bd.floatValue();
}

From source file:Main.java

public static float mulFloat(Float v1, Float v2) {

    BigDecimal b1 = new BigDecimal(Float.toString(v1));

    BigDecimal b2 = new BigDecimal(Float.toString(v2));

    return b1.multiply(b2).floatValue();

}

From source file:Main.java

public static BigDecimal round(float d, int decimalPlace) {
    BigDecimal bd = new BigDecimal(Float.toString(d));
    bd = bd.setScale(decimalPlace, BigDecimal.ROUND_HALF_UP);
    return bd;/*w w  w . jav a  2  s .c o m*/
}