how to cast a double to an integer code example
Example 1: convert double into integer
class DoubleToInt {
public static void main( String args[] ) {
double DoubleValue = 3.6987;
int IntValue = (int) DoubleValue;
System.out.println(DoubleValue + " is now " + IntValue);
}
}
Example 2: convert double to int java
double data = 3452.345
int value = (int)data;