Here you can find the source of round2(double d)
public static int round2(double d)
//package com.java2s; //License from project: Open Source License public class Main { /**/* ww w . j ava 2 s . c o m*/ * Useful for hashCode() and equals() fn's that compare stuff read from a text file. * Here we round an integer to the nearest cent and return the number of cents. */ public static int round2(double d) { return (int) (d * 100 + 0.5); } }