java Programming Glossary: decimalplace
Are there any functions for truncating a double in java? http://stackoverflow.com/questions/1976809/are-there-any-functions-for-truncating-a-double-in-java BigDecimal like so public static double round double d int decimalPlace BigDecimal bd new BigDecimal d bd bd.setScale decimalPlace BigDecimal.ROUND_HALF_UP.. decimalPlace BigDecimal bd new BigDecimal d bd bd.setScale decimalPlace BigDecimal.ROUND_HALF_UP return bd.doubleValue share improve..
What's the best practice to round a float to 2 decimals? http://stackoverflow.com/questions/8911356/whats-the-best-practice-to-round-a-float-to-2-decimals Round to certain number of decimals @param d @param decimalPlace @return public static float round float d int decimalPlace BigDecimal.. decimalPlace @return public static float round float d int decimalPlace BigDecimal bd new BigDecimal Float.toString d bd bd.setScale.. bd new BigDecimal Float.toString d bd bd.setScale decimalPlace BigDecimal.ROUND_HALF_UP return bd.floatValue You need to decide..
|