divide a number in java upto decimal places code example Example: print up to 2 decimal in java System.out.printf("%.2f", value);