Question : Java convert double to int
Answered by : adam-4zcxj3s7oreq
Double double = 5.00;
int integer = double.intValue();
Source : | Last Update : Wed, 02 Nov 22
Question : how to change double to int in java
Answered by : nitbit25
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() }
}
Source : | Last Update : Mon, 24 Feb 20
Question : convert double into integer
Answered by : jealous-jaguar-hljdilp5z6ug
class DoubleToInt { public static void main( String args[] ) { double DoubleValue = 3.6987; int IntValue = (int) DoubleValue; System.out.println(DoubleValue + " is now " + IntValue); }
}
Source : | Last Update : Tue, 09 Mar 21
Question : Java Converting double into an int
Answered by : samer-saeid
class Main { public static void main(String[] args) { // create double type variable double num = 10.99; System.out.println("The double value: " + num); // convert into int type int data = (int)num; System.out.println("The integer value: " + data); }
}
Source : | Last Update : Wed, 01 Jun 22
Question : java casting to int
Answered by : happy-hyena-ix59htgur1zl
//In java, you can cast to any primitive type by putting (primitiveType)
//before whatever you're casting to.
private static int myInt = (int)myDouble;
Source : | Last Update : Sun, 29 Nov 20
Question : grepper subscription required
Answered by : code-grepper
{"tags":[{"tag":"p","content":"You have reached your max daily Grepper answers. <a href=\"https://www.grepper.com/subscriptions.php\" target=\"_blank\" rel=\"nofollow\">Upgrade to professional </a>to view more Grepper answer today."},{"tag":"p","content":"<a href=\"https://www.grepper.com/api/view_product.php?hl=1&pid=42\" target=\"_blank\" rel=\"nofollow\">Upgrade To Grepper Professional</a>"}]}
Source : | Last Update : Mon, 27 Mar 23