Mmmm, are you sure 45.78 is what you want here? Not 45.79, which is much closer?
Depending on what you really want to do here, you may wish to add or subtract 0.005 to/from the number, to adjust the value to do the type of rounding you desire. You can experiment with different values to see how this works.
Say for example, I accept 47.898778 as the input. I dont want to round it off. I want to do a validation such that it accepts only two digits after decimal point. I want to know how to do validation for that.
If you're just trying to validate the format of the input then use a regular expression and pattern matching. If the format you want is <any number of digits>.<exactly two digits> then a regexp like this should work:
The Pattern.matches() static method will do what you want.