List of usage examples for java.lang Float Float
@Deprecated(since = "9") public Float(String s) throws NumberFormatException
From source file:Main.java
public static void main(String[] args) { Float fObj = new Float("10.50"); byte b = fObj.byteValue(); System.out.println(b);/* www . ja va2 s. c o m*/ short s = fObj.shortValue(); System.out.println(s); int i = fObj.intValue(); System.out.println(i); float f = fObj.floatValue(); System.out.println(f); double d = fObj.doubleValue(); System.out.println(d); }
From source file:MainClass.java
public static void main(String[] args) { float f = -29.6f; Float f2 = new Float(f); System.out.println(f2.floatValue()); }
From source file:Main.java
public static void main(String[] args) { Integer x = new Integer(50); Float y = new Float(50f); System.out.println(x.equals(y)); System.out.println(x.equals(50)); }
From source file:Main.java
public static void main(String[] args) { float f = 10.10f; Float fObj1 = new Float(f); System.out.println(fObj1);/* www . j a v a 2 s . c o m*/ double d = 10.10; Float fObj2 = new Float(d); System.out.println(fObj2); Float fObj3 = new Float("25.34"); System.out.println(fObj3); }
From source file:Main.java
public static void main(String[] args) { // get a number as float Number x = new Float(123456f); // get a number as double Number y = new Double(9876); // print their value as int System.out.println("x as float:" + x + ", x as Integer:" + x.intValue()); System.out.println("y as double:" + y + ", y as Integer:" + y.intValue()); }
From source file:Main.java
public static void main(String[] args) { // get a number as float Number x = new Float(123456f); // get a number as double Number y = new Double(9876); // print their value as short System.out.println("x as float :" + x + ", x as short:" + x.shortValue()); System.out.println("y as double:" + y + ", y as short:" + y.shortValue()); }
From source file:Main.java
public static void main(String[] args) { // get a number as float Number x = new Float(123456f); // get a number as double Number y = new Double(9876); // print their value as long System.out.println("x as float:" + x + ", x as long:" + x.longValue()); System.out.println("y as double:" + y + ", y as long:" + y.longValue()); }
From source file:Main.java
public static void main(String[] args) { float f = (float) 1 / 0; boolean b1 = Float.isInfinite(f); System.out.println(b1);/*from ww w .jav a 2 s . co m*/ Float fObj = new Float(f); boolean b2 = fObj.isInfinite(); System.out.println(b2); }
From source file:Main.java
public static void main(String[] args) { float f = (float) Math.sqrt(-10); boolean b1 = Float.isNaN(f); System.out.println(b1);//from w w w. j av a 2 s . com Float fObj = new Float(f); boolean b2 = fObj.isNaN(); System.out.println(b2); }
From source file:Main.java
public static void main(String[] args) { // get a number as integer Number x = new Integer(123456); // get a number as float Number y = new Float(9876f); // print their value as byte System.out.println("x as integer:" + x + ", x as byte:" + x.byteValue()); System.out.println("y as float:" + y + ", y as byte:" + y.byteValue()); }