123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
-
-
- /**
- * Created by dan on 6/14/17.
- */
- public class MathUtilities {
-
- /**
- * @param baseValue starting value
- * @param difference value to add to starting value
- * @return sum of `baseValue` and `difference`
- */
- public Integer add(int baseValue, int difference) {
- return baseValue + difference;
- }
-
- /**
- * @param baseValue starting value
- * @param difference value to add to starting value
- * @return sum of `baseValue` and `difference`
- */
- public Long add(long baseValue, long difference) {
- return baseValue + difference;
- }
-
-
- /**
- * @param baseValue starting value
- * @param difference value to add to starting value
- * @return sum of `baseValue` and `difference`
- */
- public Short add(short baseValue, short difference) {
- return (short)(baseValue + difference);
- }
-
-
- /**
- * @param baseValue starting value
- * @param difference value to add to starting value
- * @return sum of `baseValue` and `difference`
- */
- public Byte add(byte baseValue, byte difference) {
- return (byte)(baseValue + difference);
- }
-
- /**
- * @param baseValue starting value
- * @param difference value to add to starting value
- * @return sum of `baseValue` and `difference`
- */
- public Float add(float baseValue, float difference) {
- return baseValue + difference;
- }
-
- /**
- * @param baseValue starting value
- * @param difference value to add to starting value
- * @return sum of `baseValue` and `difference`
- */
- public Double add(double baseValue, double difference) {
- return baseValue + difference;
- }
-
- /**
- * @param baseValue starting value
- * @param difference value to subtract from starting value
- * @return difference between `baseValue` and `difference`
- */
- public Integer subtract(int baseValue, int difference) {
- return baseValue - difference;
- }
-
- /**
- * @param baseValue starting value
- * @param difference value to subtract from starting value
- * @return difference between `baseValue` and `difference`
- */
- public Long subtract(long baseValue, long difference) {
- return baseValue - difference;
- }
-
- /**
- * @param baseValue starting value
- * @param difference value to subtract from starting value
- * @return difference between `baseValue` and `difference`
- */
- public Short subtract(short baseValue, short difference) {
- return (short)(baseValue - difference);
- }
-
- /**
- * @param baseValue starting value
- * @param difference value to subtract from starting value
- * @return difference between `baseValue` and `difference`
- */
- public Byte subtract(byte baseValue, byte difference) {
- return (byte)(baseValue - difference);
- }
-
- /**
- * @param baseValue starting value
- * @param difference value to subtract from starting value
- * @return difference between `baseValue` and `difference`
- */
- public Float subtract(float baseValue, float difference) {
- return baseValue - difference;
- }
-
- /**
- * @param baseValue starting value
- * @param difference value to subtract from starting value
- * @return difference between `baseValue` and `difference`
- */
- public Double subtract(double baseValue, double difference) {
- return baseValue - difference;
- }
-
-
- /**
- * @param dividend value to be divided
- * @param divisor value to divide by
- * @return division of `dividend` by `divisor
- */
- public Integer divide(int dividend, int divisor) {
- return dividend/divisor;
- }
-
- /**
- * @param dividend value to be divided
- * @param divisor value to divide by
- * @return division of `dividend` by `divisor
- */
- public Long divide(long dividend, long divisor) {
- return dividend/divisor;
- }
-
- /**
- * @param dividend value to be divided
- * @param divisor value to divide by
- * @return division of `dividend` by `divisor
- */
- public Short divide(short dividend, short divisor) {
- return (short)(dividend/divisor);
- }
-
- /**
- * @param dividend value to be divided
- * @param divisor value to divide by
- * @return division of `dividend` by `divisor
- */
- public Byte divide(byte dividend, byte divisor) {
- return (byte)(dividend/divisor);
- }
-
- /**
- * @param dividend value to be divided
- * @param divisor value to divide by
- * @return division of `dividend` by `divisor
- */
- public Float divide(float dividend, float divisor) {
- return dividend/divisor;
- }
-
- /**
- * @param dividend value to be divided
- * @param divisor value to divide by
- * @return division of `dividend` by `divisor
- */
- public Double divide(double dividend, double divisor) {
- return dividend/divisor;
- }
-
-
- /**
- * @param multiplicand value to be multiplied
- * @param multiplier value to multiply by
- * @return product of `multiplicand` by `multiplier`
- */
- public Integer multiply(int multiplicand, int multiplier) {
- return multiplicand * multiplier;
- }
-
- /**
- * @param multiplicand value to be multiplied
- * @param multiplier value to multiply by
- * @return product of `multiplicand` by `multiplier`
- */
- public Long multiply(long multiplicand, long multiplier) {
- return multiplicand * multiplier;
- }
-
- /**
- * @param multiplicand value to be multiplied
- * @param multiplier value to multiply by
- * @return product of `multiplicand` by `multiplier`
- */
- public Short multiply(short multiplicand, short multiplier) {
- return (short)(multiplicand * multiplier);
- }
- /**
- * @param multiplicand value to be multiplied
- * @param multiplier value to multiply by
- * @return product of `multiplicand` by `multiplier`
- */
- public Byte multiply(byte multiplicand, byte multiplier) {
- return (byte)(multiplicand * multiplier);
- }
-
- /**
- * @param multiplicand value to be multiplied
- * @param multiplier value to multiply by
- * @return product of `multiplicand` by `multiplier`
- */
- public Float multiply(float multiplicand, float multiplier) {
- return multiplicand * multiplier;
- }
-
- /**
- * @param multiplicand value to be multiplied
- * @param multiplier value to multiply by
- * @return product of `multiplicand` by `multiplier`
- */
- public Double multiply(double multiplicand, double multiplier) {
- return multiplicand * multiplier;
- }
-
-
- /**
- * @return true
- */
- public Boolean returnTrue() {
- return true;
- }
-
- /**
- * @return false
- */
- public Boolean returnFalse() {
- return false;
- }
-
- }
|