code: public Object negate(Object val) {
      if (val instanceof Integer) {
        int valueAsInt = ((Integer) val).intValue();
        return Integer.valueOf(-valueAsInt);
      }
      else if (val instanceof Double) {
        double valueAsDouble = ((Double) val).doubleValue();
        return new Double(-valueAsDouble);
      }
      else if (val instanceof Long) {
        long valueAsLong = -((Long) val).longValue();
        return Long.valueOf(valueAsLong);
      }
      else if (val instanceof BigDecimal) {
        BigDecimal valueAsBigD = (BigDecimal) val;
        return valueAsBigD.negate();
      }
      else if (val instanceof BigInteger) {
        BigInteger valueAsBigI = (BigInteger) val;
        return valueAsBigI.negate();
      }
      else if (val instanceof Float) {
        float valueAsFloat = ((Float) val).floatValue();
        return new Float(-valueAsFloat);
      }
      else if (val instanceof Short) {
        short valueAsShort = ((Short) val).shortValue();
        return Short.valueOf((short) -valueAsShort);
      }
      else if (val instanceof Byte) {
        byte valueAsByte = ((Byte) val).byteValue();
        return Byte.valueOf((byte) -valueAsByte);
      }
      else if (val instanceof Boolean) {
        return ((Boolean) val).booleanValue() ? Boolean.FALSE : Boolean.TRUE;
      }
      throw new ArithmeticException("Object negation:(" + val + ")");
    }
docs: Negates a value (unary minus for numbers).
  
  @param val
  the value to negate
  @return the negated value