Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ValorCatastral = 35200000.873333333d;
- System.out.println("Valor Catastral del edificio: " + Math.floor(ValorCatastral) + "€");
- import java.text.DecimalFormat;
- import java.text.DecimalFormatSymbols;
- import java.util.Locale;
- public class Test {
- public static void main(String[] args) {
- String pattern = "###,###,###.## €";
- double value = 35200000.873333333d;
- //Si no le paso ningun Locale, toma el del sistema, que en mi caso es Locale("es","MX");
- DecimalFormat myFormatter = new DecimalFormat(pattern);
- String output = myFormatter.format(value);
- System.out.println(value + " " + pattern + " " + output);
- //Aquí se le pasa el default de Alemania
- myFormatter = new DecimalFormat(pattern,DecimalFormatSymbols.getInstance(Locale.GERMANY));
- output = myFormatter.format(value);
- System.out.println(value + " " + pattern + " " + output);
- }
- }
Add Comment
Please, Sign In to add comment