# Format Precision Exception? What's going on?

• October 28th, 2012, 01:41 PM
ColeTrain
Format Precision Exception? What's going on?
Code :

```public class test { public static void main(String[] args) { double meter; double foot; double x = 1; double y = 20;     System.out.println("Feet \t Meters \t | \t Meters \t Feet");   while (x <= 10 && y <= 65){ meter = footToMeter(x); foot = meterToFoot(y); System.out.printf("%10.1d \t %10.3d | %10.1d \t %10.3d", x, meter, y, foot);     x++; y += 5; }//end of while   }//end of main method   public static double footToMeter(double foot) {   return 0.305 * foot; }//end of footToMeter   public static double meterToFoot(double meter) {   return 3.279 * meter; }//end of meterToFoot       }```

it is something inside this part, but i can't figure out what is wrong:
Code :

`System.out.printf("%10.1d \t %10.3d | %10.1d \t %10.3d", x, meter, y, foot);`
• October 28th, 2012, 03:22 PM
Zaphod_b
Re: Format Precision Exception? What's going on?
Use "%d" for ints and longs.
Use "%SomethingElse" for floats and doubles.

Formatter syntax

Cheers!

Z
• October 28th, 2012, 04:40 PM
ColeTrain
Re: Format Precision Exception? What's going on?
Thanks! Works perfect now. I figured d stood for double, good to know. I appreciate the fast and informative response!
• October 28th, 2012, 06:47 PM
pbrockway2
Re: Format Precision Exception? What's going on?
d is for decimal because, in that case, we are dealing with formatting an int using its decimal (base 10) representation.