12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import java.util.*;
  2. public class NumberUtilities {
  3. public static String getRange(int stop) {
  4. String done = "";
  5. for (int i = 0; i < stop; i++){
  6. done += String.valueOf(i);
  7. }
  8. return done;
  9. }
  10. public static String getRange(int start, int stop) {
  11. String done2 = "";
  12. for (int i = start; i < stop; i++){
  13. done2 += String.valueOf(i);
  14. }
  15. return done2;
  16. }
  17. public static String getRange(int start, int stop, int step) {
  18. String done3 = "";
  19. for (int i = start; i < stop; i += step) {
  20. done3 += String.valueOf(i);
  21. }
  22. return done3;
  23. }
  24. public static String getEvenNumbers(int start, int stop) {
  25. String done4 = "";
  26. for (int i = start; i < stop; i++) {
  27. if (i % 2 == 0){
  28. done4 += String.valueOf(i);
  29. }
  30. }
  31. return done4;
  32. }
  33. public static String getOddNumbers(int start, int stop) {
  34. String done4 = "";
  35. for (int i = start; i < stop; i++) {
  36. if (i % 2 == 1){
  37. done4 += String.valueOf(i);
  38. }
  39. }
  40. return done4;
  41. }
  42. public static String getExponentiations(int start, int stop, int exponent){
  43. String done4 = "";
  44. for (int i = start; i <= stop; i++) {
  45. int k = (int)Math.pow(i, exponent);
  46. done4 += String.valueOf(k);
  47. }
  48. return done4;
  49. }
  50. }