Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.text.DecimalFormat;
- public class Main {
- public static void main(String[] args) {
- double number = 0.29998889;
- DecimalFormat df = new DecimalFormat("#.##");
- String formattedNumber = df.format(number);
- System.out.println(formattedNumber); // извежда 0.3
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement