From c98a0234ae8fad19073b8d32b24a0b1708127f0f Mon Sep 17 00:00:00 2001 From: Vaibhav Sahay Date: Sat, 8 Sep 2018 10:04:07 +0530 Subject: [PATCH] Delete DoubletoString.java --- core-java/DoubletoString.java | 38 ----------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 core-java/DoubletoString.java diff --git a/core-java/DoubletoString.java b/core-java/DoubletoString.java deleted file mode 100644 index bc88adae77..0000000000 --- a/core-java/DoubletoString.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.doubletostring; - -import java.math.RoundingMode; -import java.text.DecimalFormat; -import java.text.NumberFormat; -import java.util.Locale; - -public class DoubletoString { - - public static void main(String[] args) { - - double doubleValue = 345.56; - - System.out.println(String.valueOf((int) doubleValue)); - - System.out.println(String.format("%.0f", doubleValue)); - - doubleValue = Math.floor(doubleValue); - DecimalFormat df = new DecimalFormat("#"); - df.setRoundingMode(RoundingMode.FLOOR); - System.out.println(df.format(doubleValue)); - - Locale enlocale = new Locale("en", "US"); - String pattern = "###,##"; - df = (DecimalFormat) NumberFormat.getNumberInstance(enlocale); - df.applyPattern(pattern); - String format = df.format(doubleValue); - System.out.println(format); - - Locale dalocale = new Locale("da", "DK"); - df = (DecimalFormat) NumberFormat.getNumberInstance(dalocale); - df.applyPattern(pattern); - System.out.println(df.format(doubleValue)); - - - } - -}