Example usage for java.lang Float shortValue

List of usage examples for java.lang Float shortValue

Introduction

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

Prototype

public short shortValue() 

Source Link

Document

Returns the value of this Float as a short after a narrowing primitive conversion.

Usage

From source file:Main.java

public static void main(String[] args) {
    Float floatObject = new Float("10.01");

    short s = floatObject.shortValue();
    System.out.println("short:" + s);
}

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);/*from  w  w w  .ja v a  2 s. co  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);
}