List of utility methods to do BigDecimal to
double | convertBigDecimalTodouble(BigDecimal bigDecimalVal) Convert big decimal todouble. if (bigDecimalVal != null) { return bigDecimalVal.doubleValue(); return 0; |
byte[] | convertBigDecimalToSQLBigNum(BigDecimal bd, int targetLength, int targetScale) convert Big Decimal To SQL Big Num byte[] sourceData = bd.setScale(targetScale, BigDecimal.ROUND_DOWN).unscaledValue().toString().getBytes(); byte[] targetData = new byte[targetLength]; int[] targetInShorts = new int[targetLength / 2]; int length; int temp; int tarPos = 1; int zeros = 0; while (zeros < sourceData.length && (sourceData[zeros] == '0' || sourceData[zeros] == '-')) ... |
boolean | convertBigDecimalToString(BigDecimal bigValue) convert Big Decimal To String if (bigValue.intValue() == 0) { return false; return true; |
BigDecimal | convertDoubleToBigDecimal(Double value) convert Double To Big Decimal return new BigDecimal(Math.round(value)); |
BigDecimal | convertDoubleToBigDecimal(final Double score, final int decimalPlaces) convert Double To Big Decimal return new BigDecimal(score).setScale(10, RoundingMode.HALF_UP).setScale(decimalPlaces, RoundingMode.HALF_UP); |
BigDecimal | convertFeetToInches(BigDecimal feet) convert Feet To Inches return feet.multiply(BigDecimal.valueOf(12));
|
BigDecimal | convertHoursToMillis(BigDecimal hours) Number of hours = # of hours * 60 seconds * 60 minutes * 1000 millis return hours.multiply(convertMinutesToMillis(new BigDecimal(60))); |
BigDecimal | convertNullToBigDecimal(Object orgStr) : convertNullToDate if (orgStr == null || orgStr.toString().equals("")) { return new BigDecimal("0"); } else { return (BigDecimal) (orgStr); |
BigDecimal | convertRadiansToDegrees(BigDecimal radians) Converts the radians to degrees return multiplyBy(radians, new BigDecimal(180 / PI)); |
BigDecimal | convertRating(BigDecimal rating) convert Rating if (rating == null) { return null; int decimalPlaces = 2; int r = 1; for (int i = 0; i < decimalPlaces; i++) { r *= 10; return BigDecimal.valueOf(Math.round((5 + rating.doubleValue() * (-4)) * r) / r); |