code: public boolean sameValue(Object value1, Object value2) {
      return ((BigDecimal)value1).compareTo((BigDecimal)value2) == 0;
    }
docs: BigDecimal.equals considers objects distinct if they have the
  different scales but the same mathematical value. Similarly
  for hashCode.