s3a
October 19th, 2009, 06:16 PM
Here is my code:
import java.text.DecimalFormat;
import java.util.Scanner;
public class decform_checker
{
public static void main (String [] args)
{
Scanner kb = new Scanner(System.in);
double number = kb.nextDouble();
DecimalFormat formatter = new DecimalFormat("#0,000.000%");
System.out.println(formatter.format(number));
}
}
I would appreciate it if somebody could explain what the # does in detail because I don't understand what I read on it and I don't find much to read about it either.
Thanks in advance!
import java.text.DecimalFormat;
import java.util.Scanner;
public class decform_checker
{
public static void main (String [] args)
{
Scanner kb = new Scanner(System.in);
double number = kb.nextDouble();
DecimalFormat formatter = new DecimalFormat("#0,000.000%");
System.out.println(formatter.format(number));
}
}
I would appreciate it if somebody could explain what the # does in detail because I don't understand what I read on it and I don't find much to read about it either.
Thanks in advance!