class Scratch{
public static void main(String[] args){
double decimal = 5.7;
System.out.println( (int) decimal ); //casting
System.out.println( Math.round(decimal * 10) / (double) 10); //Math.round()
System.out.println( decimal % 1); // modulus
System.out.println( Integer.parseInt( String.valueOf(decimal).substring(0, String.valueOf(decimal).indexOf(".")))); // .substring()
}
}
class DoubleToInt {
public static void main( String args[] ) {
double DoubleValue = 3.6987;
int IntValue = (int) DoubleValue;
System.out.println(DoubleValue + " is now " + IntValue);
}
}
double value = 4.3;
int convertedValue = value % 1;
@SuppressWarnings("deprecation")
int Entero=new Double(345.8).intValue();
Double double = 5.00;
int integer = double.intValue();