Sobes.tech
Junior — Senior

Creating a byte array according to FizzBuzz rules

livecode

Task condition

The method takes an integer number and returns a byte array formed according to the following principles:

  1. If the number is divisible by 3 — add the string Fizz to the array.
  2. If the number is divisible by 5 — add the string Buzz to the array.
  3. If the number is divisible by both 3 and 5 — add the string FizzBuzz to the array.
  4. If the number is not divisible by 3 or 5 — the method throws an IllegalArgumentException. The solution should be accompanied by a set of unit tests.
public class FizzBuzzGenerator {
    public byte[] generate(int number) {
        throw new RuntimeException("Not implemented yet");
    }
}