A double doesn't have any number of decimal points. You can try rounding it to 2dp precision, which is as near as you will get. There is the Math.round() method, but you will have to multiply and divide to use that. You can use several methods, one of which you have already found, to display it with 2dp.