I don't know in what contest you want this, In case you are showing some text input field and you want user to enter only float till two decimal point the you can achieve this using java script.
In the function attached you need to pass the value entered by user in this Java script function function validDecimal(str)
If User enters more than 2 decimal points, put an alert message.
Older versions of the JDK (pre 1.1 if I remember right) had a setPrecision method on floating point numbers. The idea was you could set the prescision of the number before you used it in any calculations. This is long since gone in favour of the java.text.NumberFormat stuff, which is precision for display only i.e. you would perform any calculations on the float as is, then format it for display to two decimal places.
Post by:autobot
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
a bit of art, as a gift, the permaculture playing cards