List of utility methods to do BigDecimal Format
String | getFormatSizeByKB(long size) get Format Size By KB double kiloByte = size / 1024; if (kiloByte < 1) { return size + "KB"; double megaByte = kiloByte / 1024; if (megaByte < 1) { BigDecimal result1 = new BigDecimal(Double.toString(kiloByte)); return result1.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "MB"; ... |
boolean | isLess(float formateValue1, float formateValue2) is Less BigDecimal n1 = new BigDecimal(formateValue1); BigDecimal n2 = new BigDecimal(formateValue2); return n1.compareTo(n2) == -1 ? true : false; |
String | timeToEMTFormat(long elapsedTimeMillis) Chess base EMT format. double elapsedTimeInSeconds = elapsedTimeMillis / 1000.0; BigDecimal bigDecimal = new BigDecimal(elapsedTimeInSeconds); bigDecimal = bigDecimal.setScale(3, BigDecimal.ROUND_HALF_UP); return "[%emt " + bigDecimal.toString() + "]"; |
String | toNormalFenFormat(String fen) to Normal Fen Format return String.valueOf(new BigDecimal(fen)); |
String | unformattedFromDouble(double n, int decimals) Convert a double to the unformatted form. return unformattedFromBigDecimal(new BigDecimal(n).setScale(decimals, BigDecimal.ROUND_HALF_UP)); |