Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double d = 2.555;
- BigDecimal bd = new BigDecimal(d);
- BigDecimal rounded = bd.setScale(2, BigDecimal.ROUND_HALF_UP);
- System.out.println(rounded);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement