i want to change the decimal spaces of an double, depending on the int value that i use. I Figured out, that i can change the decimal spaces "manually" by changing to 10 or 1000 and so on, but i dont know how to accomplish this, other than changing said values in the code.
My second quest is how to round double values for example 19.657 up to 19.66, or 19.652 down to 19.65 .
Note :
WITHOUT the use of imports and only the default package
I use Java with Eclipse as my IDE
Thank you in advance for your effort :)
double x = 19.657821456;
int y = 3;
x = x*10;
x = (double)((int) x);
x = x /10;