List of utility methods to do Number Round
double | roundOff(double fraction, int precision) Rounds off fraction to the given amount of precision. int i = 0; int finalNum = 1; while (i++ < precision) { finalNum *= 10; return (double) Math.round(fraction * finalNum) / finalNum; |
double | roundOffAmt(double dAmt) round Off Amt return Math.round(dAmt * 10000000000.0) / 10000000000.0;
|
String | roundOffFileCount(int fileCount) round Off File Count String fileCountStr = String.valueOf(fileCount); if (fileCountStr.length() == 1) { fileCountStr = "0" + fileCountStr; return fileCountStr; |
double | roundOffTo2DecPlaces(double val) round Off To Dec Places return Math.round(val * 100) / 100; |
double[] | roundOffValues(double[] doubles) round Off Values double[] returnDoubles = new double[doubles.length]; for (int i = 0; i < doubles.length; i++) { returnDoubles[i] = Math.round(doubles[i]); return returnDoubles; |
double | roundPhred(final double value, final double phredScorePrecision) Round a Phred scaled score to precision phredScorePrecision return Math.round(value / phredScorePrecision) * phredScorePrecision;
|
int | roundPos(final float a) Round a positive a return (int) (a + 0.5f); |
int | roundPositive(float value) Returns the closest integer to the specified float. return (int) (value + 0.5f); |
int | roundPositive(float x) round Positive return (int) (x + 0.5f); |
int | roundPositiveIntToPowerOf2(int i) round Positive Int To Power Of if (i <= 0) { throw new IllegalArgumentException(); return Integer.bitCount(i) == 1 ? i : Integer.highestOneBit(i) << 1; |