speedy_kevin Posted October 28, 2004 Share Posted October 28, 2004 I got a program that turns out math answer. The answer is 678.617475728155 But I want to to have 7 digits after the dot. Like: 678.6174757 I got this code: Math.floor(n + 0.7d); n is the var with the answer. But It's not working? I stil get the whole answer after the math.floor Anyone knows why? grtz Speedy Link to comment Share on other sites More sharing options...
0 Rathamon Posted October 28, 2004 Share Posted October 28, 2004 Use the NumberFormat class http://java.sun.com/j2se/1.5.0/docs/api/ja...mberFormat.html Link to comment Share on other sites More sharing options...
Question
speedy_kevin
I got a program that turns out math answer. The answer is 678.617475728155
But I want to to have 7 digits after the dot. Like: 678.6174757
I got this code:
Math.floor(n + 0.7d);
n is the var with the answer. But It's not working? I stil get the whole answer after the math.floor
Anyone knows why?
grtz
Speedy
Link to comment
Share on other sites
1 answer to this question
Recommended Posts