public static int round(double value){
  return value > 0 ? (int)(value + 0.5) : -(int)(Math.abs(value) + 0.5);
}

public static int round ( double value ) { return value > 0 ? ( int ) ( value + 0.5 ) : - ( int ) ( Math . abs ( value ) + 0.5 ) ; }
rounds a double to the next nearest integer value . the jdk version of it doesn ' t work properly .
