Dúvida NumberFormat[RESOLVIDO]

Bom Tarde a todos,

Galera estou com a seguinte dúvida, eu tenho um formato diferente de números e quero que todos retornem o mesmo formato após chamar o método format da classe NumberFormat o teste é o seguinte independendo do tipo de número que receber como parâmetro deve retornar o mesmo separando suas casas com separador de milhar(.) e os decimais com virgula"," deve ter obrigatoriamente 2 casas decimais, se não tiver preencher com zeros como fazer isso com o NumberFormat?

segue e o exemplo

import java.text.DecimalFormat;
import java.text.NumberFormat;

public class FormatNumbersTeste {
	public static void main(String[] args){
		NumberFormat fN = DecimalFormat.getInstance();
		
		float x1 = 1.5f;
		float x2 = 1.03f;
		float x3 = 1f;
		float x4 = 10000000f;
		float x5 = 12345.5674f;
		float x6 = 12345.0674f;
		
		System.out.println("x1 = " + String.valueOf(x1) + "  ------->  " + String.valueOf(fN.format(x1)));
		System.out.println("x2 = " + String.valueOf(x2) + "  ------->  " + String.valueOf(fN.format(x2)));
		System.out.println("x3 = " + String.valueOf(x3) + "  ------->  " + String.valueOf(fN.format(x3)));
		System.out.println("x4 = " + String.valueOf(x4) + "  ------->  " + String.valueOf(fN.format(x4)));
		System.out.println("x5 = " + String.valueOf(x5) + "  ------->  " + String.valueOf(fN.format(x5)));
		System.out.println("x6 = " + String.valueOf(x6) + "  ------->  " + String.valueOf(fN.format(x6)));
	}
}

O x1 deveria sair igual a “1,50”
O x2 deveria sair igual a “1,50” ESTÁ CORRETO
O x3 deveria sair igual a “1,00”
O x4 deveria sair igual a “10.000.000,00”
O x5 deveria sair igual a “12.345,56”
O x6 deveria sair igual a “12.345,06”

Espero que seja possível fazer isto

É possível, sim. A documentação abaixo explica como:

http://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html

[quote=roger_rf]É possível, sim. A documentação abaixo explica como:

http://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html[/quote]

Muito Obrigado Roger

Era exatamente o que eu estava precisando

Caso alguém um dia precise saber a solução:

import java.text.DecimalFormat;
import java.text.NumberFormat;


public class FormatNumbersTeste {
	public static void main(String[] args){
		//NumberFormat fN = DecimalFormat.getInstance();
		NumberFormat fN = new DecimalFormat("###,###,###.00");

		float x1 = 1.5f;
		float x2 = 1.03f;
		float x3 = 1f;
		float x4 = 100000000f;
		float x5 = 12345.5674f;
		float x6 = 12345.0674f;
		
		System.out.println("x1 = " + String.valueOf(x1) + "  ------->  " + String.valueOf(fN.format(x1)));
		System.out.println("x2 = " + String.valueOf(x2) + "  ------->  " + String.valueOf(fN.format(x2)));
		System.out.println("x3 = " + String.valueOf(x3) + "  ------->  " + String.valueOf(fN.format(x3)));
		System.out.println("x4 = " + String.valueOf(x4) + "  ------->  " + String.valueOf(fN.format(x4)));
		System.out.println("x5 = " + String.valueOf(x5) + "  ------->  " + String.valueOf(fN.format(x5)));
		System.out.println("x6 = " + String.valueOf(x6) + "  ------->  " + String.valueOf(fN.format(x6)));
		
		
	}
}

Mais uma vez obrigado