Example usage for java.text DecimalFormat DecimalFormat

List of usage examples for java.text DecimalFormat DecimalFormat

Introduction

In this page you can find the example usage for java.text DecimalFormat DecimalFormat.

Prototype

public DecimalFormat() 

Source Link

Document

Creates a DecimalFormat using the default pattern and symbols for the default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setNegativePrefix("minus");
    System.out.println(format.format(-123456789.12345678));

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();

    System.out.println(format.toLocalizedPattern());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setMultiplier(100);//from   ww w .  ja  v a  2  s  . c o m
    System.out.println(format.format(123456789.12345678));

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setDecimalSeparatorAlwaysShown(false);
    System.out.println(format.format(123456789.12345678));

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setPositiveSuffix("Positive");
    System.out.println(format.format(123456789.12345678));

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();

    System.out.println(format.toPattern());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();

    format.setMinimumIntegerDigits(4);/*from   ww w.j  ava  2s. c o m*/

    System.out.println(format.format(123456789.12345678));

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();

    format.setGroupingSize(4);/*w w w . j  av a2 s  .c  om*/

    System.out.println(format.format(123456789.12345678));

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();

    format.setMaximumFractionDigits(4);//from  w w  w .j a v  a2 s.c o m

    System.out.println(format.format(123456789.12345678));

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();

    format.setMinimumFractionDigits(4);/*from w  ww  .  j  a v  a  2 s .  c om*/

    System.out.println(format.format(123456789.12345678));

}