Junior — Senior
FizzBuzz: creating a byte array from a given number
livecode
Task condition
Implement the method fizzbuzztzest that takes a single integer parameter num and returns a byte array. The array should be formed according to the following rules:
- if the number is divisible by 3 without a remainder — write the string
"Fizz"; - if the number is divisible by 5 without a remainder — write the string
"Buzz"; - if the number is divisible by both 3 and 5 — write the string
"FizzBuzz"; - if the number is not divisible by either 3 or 5 — throw an
IllegalArgumentException. Write unit tests covering all behavior scenarios.
public byte[] fizzbuzztzest(int num) {
throw new Error("Not implemented yet");
}