Return | Method | Summary |
---|---|---|
byte | byteValueExact() | Converts this BigDecimal to a byte, checking for lost information. |
double | doubleValue() | Converts this BigDecimal to a double. |
float | floatValue() | Converts this BigDecimal to a float. |
int | intValue() | Converts this BigDecimal to an int. |
int | intValueExact() | Converts this BigDecimal to an int, checking for lost information. |
long | longValue() | Converts this BigDecimal to a long. |
long | longValueExact() | Converts this BigDecimal to a long, checking for lost information. |
short | shortValueExact() | Converts this BigDecimal to a short, checking for lost information. |
BigInteger | toBigInteger() | Converts this BigDecimal to a BigInteger. |
BigInteger | toBigIntegerExact() | Converts this BigDecimal to a BigInteger, checking for lost information. |
import java.math.BigDecimal;
public class Main {
public static void main(String[] args) {
BigDecimal first = new BigDecimal(-1f);
System.out.println(first.floatValue());
}
}
The output:
-1.0
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |