I need to divide a with b and round that number to a n number of decimals. example : a = 2 b = 52 n = 5 , Solution = 0.03846. I can only use intigers!!
I've been working with decimalformat but I don't know how to make the format custom.
DecimalFormat nstevilo = new DecimalFormat("#.###");//I need to change ### to a n-number.
if(x<y) {
double a = x/y;
System.out.print(nstevilo.format(a));
}
This only outputs #.### because of the format i need to make it #.######- n times of decimal.