http://blog.csdn.net/windone0109/article/details/5355379 into a method: that is, the omission of the bit as long as greater than 0 to go into a bit;
Rounding Method: That is, the omission of the bit less than five are to be shed, but the omission of the bit on the full five to go into a bit;
There is also a
To the end of the law: that is omitted in the position whether or not full five are to be shed;
1. Divide with decimals
For example:
int a = 8;
int b = 3;
int c = ((double) LA)/b;
System.out.println (c);
System Printed: 2.6666666666666665
2, the realization of the progressive method
Implemented with Math.ceil (), such as Math.ceil (2.1), the result is 3.0
For example:
int a = 8;
int b = 3;
int c = ((double) LA)/b;
int d = (int) math.ceil (c);
System.out.println (d);
System printed: 3
Implementation of Java division result with decimal and progressive method