private static boolean areDoubleValuesSame(Expression expression1,Expression expression2){
  double value1=getValue(expression1);
  double value2=getValue(expression2);
  return (Math.abs(value1 - value2) < 0.001);
}

private static boolean areDoubleValuesSame ( Expression expression1 , Expression expression2 ) { double value1 = getValue ( expression1 ) ; double value2 = getValue ( expression2 ) ; return ( Math . abs ( value1 - value2 ) < 0.001 ) ; }
checks if expression values are the same same .
