0
how can i test if a float (or double) value is an integer like 1.0 or 2.00.. ? in java
there is some methode to test if the float value is an integer ?? and how can i convert it ??
4 Respuestas
+ 1
@ghozzi
you mean like this
https://code.sololearn.com/ccwczhMQN2WO/?ref=app
i use double instead, try to change the "a" value
+ 2
thank's
0
when declare a variable, the type of data wont change unless you convert it and save in different variable
example:
float a = 1.00;
int b;
b = (int) a; or you can use -> Math.round() to round it to nearest int
0
@andika
no just i want to convert a float value to int if the value like 1.0