public static long bround(long input, int scale) {
    return BigDecimal.valueOf(input).setScale(scale, RoundingMode.HALF_EVEN).longValue();
  }
Rounding a double is approximate, as the double value itself is approximate.
A double literal, such as 3.15, may not be represented internally exactly as
3.15. thus, the rounding value of it can be off on the surface. For accurate
rounding, consider using decimal type.

@param input input value
@param scale decimal place
@return rounded value
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/RoundUtils.java