java double to string fixed precision

Solutions on MaxInterview for java double to string fixed precision by the best coders in the world

showing results for - "java double to string fixed precision"
Amy
20 Jan 2017
1Double toBeTruncated = new Double("3.5789055");
2
3Double truncatedDouble = BigDecimal.valueOf(toBeTruncated)
4    .setScale(3, RoundingMode.HALF_UP)
5    .doubleValue();