Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.text.*;
- public class DecimalPlaces {
- public static void main(String[] args) {
- double d = 1.234567;
- DecimalFormat df = new DecimalFormat("#.##");
- df.setMaximumFractionDigits(2);
- df.setMinimumFractionDigits(2);
- System.out.print(df.format(d));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement