NumberUtilities.java 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. public class NumberUtilities {
  2. public static String getRange(int stop) {
  3. String total = "";
  4. for(int i=0; i < stop; i++){
  5. total += i;
  6. }
  7. return total;
  8. }
  9. public static String getRange(int start, int stop) {
  10. String amount = "";
  11. for(int i = 0; start > stop; i++){
  12. amount += i;
  13. }
  14. return amount;
  15. }
  16. public static String getRange(int start, int stop, int step) {
  17. String amount ="";
  18. for(int i = 0; start > stop; i+=step){
  19. amount += i;
  20. }
  21. return amount;
  22. }
  23. public static String getEvenNumbers(int start, int stop) {
  24. String amount = "";
  25. int j = 2 % stop;
  26. for(int i = 0; start > stop; i+=j){
  27. amount += i;
  28. }
  29. return amount;
  30. }
  31. public static String getOddNumbers(int start, int stop) {
  32. String amount ="";
  33. }
  34. public static String getExponentiations(int start, int stop, int exponent) {
  35. return null;
  36. }
  37. }