This week's giveaway is in the Spring forum. We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line! See this thread for details.

Hi there. This is a really quick one. If I have a float value 3.5711762E-6, how do I just return the number to four decimal places, i.e. 3.5718. Cheers, Joe

Probably have to convert it to a string and then use subString to get the right number of digits. If you were to use BigDecimal I think it has methods that do that for you.

It depends on how you want to use the rounded version. If you are simply displaying the value, then you should use the NumerFormat class. If you need to round a number for calculations, you should look at the round() method in the Math class.