lots of exercises in java... from https://github.com/exercism/java

12345678910111213141516171819202122232425
  1. public class Raindrops {
  2. public static String convert(int number) {
  3. String result = "";
  4. if (number % 3 == 0) {
  5. result += "Pling";
  6. }
  7. if (number % 5 == 0) {
  8. result += "Plang";
  9. }
  10. if (number % 7 == 0) {
  11. result += "Plong";
  12. }
  13. if (result == null || result.isEmpty()) {
  14. result = Integer.toString(number);
  15. }
  16. return result;
  17. }
  18. }