"Formatting" in console apps and DecimalFormat
Hi, I've written a program that takes values of an angle in degrees, performs some calculations (after converting to radians of course) and then outputs all the data in 4 columns The last column isn't aligned properly (see http://www.zenadsl3101.zen.co.uk/ballistics.JPG). Is there any way to have that column aligned like the others?
The other thing is that I used a DecimalFormat object to round the calculated values to 4 dp. This is fine for all the values except for X when t = 90 (again, see screenshot). The value printed is 0.0000, which is actually correct (as the program calculates sin(2*tInRadians) multiplied by stuff). However, before using DecimalFormat, the value for X at t = 90 was given as a really small number, of order 10^-15. I assume that this is because when calculating the value of sin(2*tInRadians), it can't take the whole value of π/2 as it's irrational, so some data is lost. What I want to do is have this value rounded to 4dp, so I get 4.xxxxE-15, or something. How can I do this?
Also, I'm forced to use JDK 1.2.2_10 .
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center