123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
-
-
- /**
- * 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) {
- int result = baseValue + difference;
- return result;
- }
-
- /**
- * @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) {
- long result = baseValue + difference;
- return result;
- }
-
- /**
- * @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) {
- short result = (short) (baseValue + difference);
- return result;
- }
-
- /**
- * @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) {
- byte result = (byte) (baseValue + difference);
- return result;
- }
-
- /**
- * @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) {
- float result = baseValue + difference;
- return result;
- }
-
- /**
- * @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) {
- double result = baseValue + difference;
- return result;
- }
-
- /**
- * @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) {
- int result = baseValue - difference;
- return result;
- }
-
- /**
- * @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) {
- long result = baseValue - difference;
- return result;
- }
-
- /**
- * @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) {
- short result = (short) (baseValue - difference);
- return result;
- }
-
- /**
- * @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) {
- byte result = (byte) (baseValue - difference);
- return result;
- }
-
- /**
- * @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) {
- float result = baseValue - difference;
- return result;
- }
-
- /**
- * @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) {
- double result = baseValue - difference;
- return result;
- }
-
-
- /**
- * @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) {
- int result = dividend/divisor;
- return result;
- }
-
- /**
- * @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) {
- long result = dividend/divisor;
- return result;
- }
-
- /**
- * @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) {
- short result = (short) (dividend/divisor);
- return result;
- }
-
- /**
- * @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) {
- byte result = (byte) (dividend/divisor);
- return result;
- }
-
- /**
- * @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) {
- float result = dividend/divisor;
- return result;
- }
-
- /**
- * @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) {
- double result = dividend/divisor;
- return result;
- }
-
-
- /**
- * @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) {
- int result = multiplicand*multiplier;
- return result;
- }
-
- /**
- * @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) {
- long result = multiplicand*multiplier;
- return result;
- }
-
- /**
- * @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) {
- short result = (short) (multiplicand*multiplier);
- return result;
- }
- /**
- * @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) {
- byte result = (byte) (multiplicand*multiplier);
- return result;
- }
-
- /**
- * @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) {
- float result = multiplicand*multiplier;
- return result;
- }
-
- /**
- * @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) {
- double result = multiplicand*multiplier;
- return result;
- }
-
-
- /**
- * @return true
- */
- public Boolean returnTrue() {
- return true;
- }
-
- /**
- * @return false
- */
- public Boolean returnFalse() {
- return false;
- }
-
- }
|