/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		System.out.println("Rounded: " + round(2.655d,2)); // -> 2.65
		System.out.println("Rounded: " + round(1.655d,2)); // -> 1.66
	}
	
	
	    static Double round(Double d, int precise) {
    BigDecimal bigDecimal = BigDecimal.valueOf(d);
    bigDecimal = bigDecimal.setScale(precise, RoundingMode.HALF_UP);
    return bigDecimal.doubleValue();
}


}