List of utility methods to do Number Round
void | Round(Object in) Round if (in == null) return; if (in instanceof int[]) { int[] inn = (int[]) in; for (int i = 0, s = inn.length; i < s; i++) inn[i] = (int) (int) inn[i]; } else { for (int i = 0, s = ((Object[]) in).length; i < s; i++) ... |
String | round(String num, int length) round if (num.indexOf('.') < 0) return num; if (num.length() <= length) return num; if (num.charAt(length) >= '5' && num.charAt(length) != '.') { char[] temp = new char[length + 1]; int ct = length; boolean rounding = true; ... |
int | round4(int n) round return n + round4[n & 3];
|
int | round_pow2(int x) Round_pow2. int ans = 1; while (ans < x) { ans *= 2; return ans; |
int | round_up(int value, int multiple) Round a number up to a given multiple. return (((value - 1) / multiple) + 1) * multiple;
|
int | roundAdd(double a, double b) Addieren und dann das Ergebnis runden. return round(a + b);
|
int | roundAndCrop(final float x, final int min, final int max) First calls Math.round with x and then crops the resulting value to the range min to max .
final int rx = Math.round(x); return crop(rx, min, max); |
int | roundByGridSize(int value) round By Grid Size value = value + (GRID_SIZE / 2);
value = value / GRID_SIZE;
value = value * GRID_SIZE;
return value;
|
int | roundByte(final double value) Rounds a float value and clamp the result between 0 and 255 inclusive. return (int) Math.min(Math.max(Math.round(value), 0), 255); |
int | roundBytesToGB(long bytes) Round bytes to GiB (gibibyte) return Math.round((float) bytes / 1024 / 1024 / 1024); |