Rounding Logic for decimal digits in java

Phulkala Narvekar

I need the rounding logic in the following pattern..for 2.23 it should be 2.2 ,for 2.26 it should be 2.3... Please Help out

raki
double a = <ur NUmber>;
double roundOff = (double) Math.round(a*10)/10;

Hope this would help you. here 2.25 would be round off to 2.3

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Double to Decimal without rounding after 15 digits

From Dev

PHP: rounding a number into 16 decimal digits

From Dev

PHP: rounding a number into 16 decimal digits

From Dev

java decimal format not rounding correctly

From Dev

show 4 digits after a decimal without rounding the values

From Dev

rounding of digits

From Dev

rounding of digits

From Dev

Rounding Decimal

From Dev

Limit decimal digits in Java when using double

From Dev

Java get first 2 decimal digits of a double

From Java

String.format() rounding a double with leading zeros in digits - Java

From Dev

Java, how to truncate digits in a long such in a way that mimics rounding?

From Dev

Java BigDecimal: Rounding off to client preferred digits and increment

From Dev

Regex: rounding all the real number in a text file (keeping the 15 decimal digits)

From Dev

Why doesn't Python include number of digits I specify after the decimal point when rounding?

From Dev

Rounding to n significant digits

From Dev

Rounding digits in ggpairs

From Dev

Rounding mismatch between ASP .net C# Decimal to Java Double

From Dev

Rounding logic in Python?

From Dev

Moving decimal without rounding

From Dev

Decimal rounding and printer selection

From Dev

Mask a decimal without rounding

From Dev

.Net decimal rounding oddities

From Dev

Rounding to two decimal places

From Dev

Decimal not rounding properly

From Dev

Decimal module: rounding

From Dev

Decimal rounding and printer selection

From Dev

Decimal Rounding in C#

From Dev

Rounding to two decimal places