Here you can find the source of roundTo2Digits(double amount)
public static double roundTo2Digits(double amount)
//package com.java2s; //License from project: Apache License public class Main { public static double roundTo2Digits(double amount) { long number2 = Math.round(amount * 100); return (double) (number2 / 100); }//www . j ava2 s .c o m }