package Capitulo_3;


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author felix
 */

import java.text.DecimalFormat;

public class FormatoDecimal {

   static public void FormatoAjustable(String pattern, double value ) {
      DecimalFormat myFormato = new DecimalFormat(pattern);
      String output = myFormato.format(value);
      System.out.println(value + "  " + pattern + "  " + output);
   }

   static public void main(String[] args) {

      FormatoAjustable("###,###.###", 123456.789);
      FormatoAjustable("###.##", 123456.789);
      FormatoAjustable("000000.000", 123.78987);
      FormatoAjustable("$###,###.###", 12345.67);  
   }
}
