Here you can find the source of roundHalfAway(double d)
public static double roundHalfAway(double d)
//package com.java2s; public class Main { public static double roundHalfAway(double d) { if (d < 0) { d = Math.ceil(d - 0.5); } else if (d > 0) { d = Math.floor(d + 0.5); }//ww w. j av a 2s. c om return d; } }