123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. public class NumberUtilities {
  2. public static String getRange(int stop) {
  3. String range = "";
  4. for (int x = 0; x < stop; x++){
  5. range += x;
  6. }
  7. return range;
  8. }
  9. public static String getRange(int start, int stop) {
  10. String rangeSS = "";
  11. for (int x = start; x < stop; x++){
  12. rangeSS += x;
  13. }
  14. return rangeSS;
  15. }
  16. public static String getRange(int start, int stop, int step) {
  17. String rangeSSS = "";
  18. for (int x = start; x < stop; x+=step){
  19. rangeSSS += x;
  20. }
  21. return rangeSSS;
  22. }
  23. public static String getEvenNumbers(int start, int stop) {
  24. String rangeE = "";
  25. for (int x = start; x < stop; x++){
  26. if(x%2 == 0)
  27. rangeE += x;
  28. }
  29. return rangeE;
  30. }
  31. public static String getOddNumbers(int start, int stop) {
  32. String rangeO = "";
  33. for (int x = start; x < stop; x++){
  34. if(x%2 == 1)
  35. rangeO += x;
  36. }
  37. return rangeO;
  38. }
  39. public static String getExponentiations(int start, int stop, int exponent) {
  40. String rangeEX = "";
  41. for (int x = start; x <= stop; x++){
  42. rangeEX += (int)(Math.pow(x, exponent));
  43. }
  44. return rangeEX;
  45. }
  46. }