You can try BigDecimal for this purpose
Double toBeTruncated = new Double("3.5789055");
Double truncatedDouble = BigDecimal.valueOf(toBeTruncated)
.setScale(3, RoundingMode.HALF_UP)
.doubleValue();
More Related Contents:
- Reference variables in java [closed]
- Can't find the way to move an image (or others clickable objects)
- Division In C++ and java?
- Does Apache Ignite work on jre1.6
- Difference between File.separator and slash in paths
- Is method reference caching a good idea in Java 8?
- @RunWith(MockitoJUnitRunner.class) vs MockitoAnnotations.initMocks(this)
- How do I make an http request using cookies on Android?
- How to read json file into java with simple JSON library
- After Spring Boot 2.0 migration: jdbcUrl is required with driverClassName
- Using Enum values as String literals
- java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
- What is the difference between a synchronized method and synchronized block in Java? [duplicate]
- Is it possible to programmatically configure JAXB?
- Oozie: Launch Map-Reduce from Oozie action?
- How to get all classes names in a package? [duplicate]
- Why would a “java.net.ConnectException: Connection timed out” exception occur when URL is up?
- Using system environment variables in log4j xml configuration
- Embed a 3rd-party JApplet in a Swing GUI & pass it parameters
- Any simple (and up to date) Java frameworks for embedding movies within a Swing Application?
- Difference between extracting and packaging libraries into a jar file
- Adding to an ArrayList Java
- Proguard and reflection in Android
- Is it possible to write a generic enum converter for JPA?
- Thread safe Hash Map?
- Is *this* really the best way to start a second JVM from Java code?
- What’s the best way to check if a String contains a URL in Java/Android?
- Array of function pointers in Java [duplicate]
- Does Pattern.compile cache?
- Setting the correct PATH for Eclipse