Four additional ways:
a)You can use printf to convert it to a string (with the exact number of wanted digits given in printf format string), and then convert it back from String to Number. You can also use DecimalFormat.format() class for it.
b) You can convert it to a String with String.valueOf(num), cut off the last digits with String.substring(), and then convert it back with Double.parseDouble()
c) You can multiply the number with a power of 10. If you want to trim away n digits, then you would multiply with Math.pow(10, n). In your case it's 10000. Then you can cut off the last digits with Math.round() or Math.rint() or Math.floor(), whatever suits you best. Then you would divide the result by the number you multiplied before (in your case 10000). But sometimes you get inaccurate results depending on your math processor hardware. So for high accuracy, but less speed, use functions of StrictMath package.
d) best solution: download Jakarta Commons library MathUtils.
Then use MathUtils.round(num, n) , which rounds the given value "num" to the specified number "n" of decimal places.