12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
-
-
-
- public class NumberUtilities {
-
-
- public static String getRange(int stop) {
- String total = "";
-
- for(int i=0; i < stop; i++){
- total += i;
-
- }
-
- return total;
- }
-
- public static String getRange(int start, int stop) {
- String amount = "";
- for(int i = 0; start < stop; i++){
-
- amount += i;
-
- }
-
- return amount;
-
- }
-
-
- public static String getRange(int start, int stop, int step) {
-
- String amount ="";
- for(int i = 0; start < stop; i+=step){
-
-
- amount += i;
-
-
- }
- return amount;
- }
-
- public static String getEvenNumbers(int start, int stop) {
- String amount = "";
-
-
- for(int i = start; i < stop; i++){
- if (i % 2 == 0) {
-
- amount += i;
- }
- }
- return amount;
-
- }
-
-
- public static String getOddNumbers(int start, int stop) {
- String amount ="";
-
- for(int i = start; i < stop; i++){
- if(i % 2 != 0){
- amount += i;
- }
- }
- return amount;
-
- }
-
-
- public static String getExponentiations(int start, int stop, int exponent) {
- String amount = "";
-
- for(int i =start; i < stop; i++){
- amount += (int) Math.pow(i, exponent);
- }
- return amount;
-
- }
- }
|