class Solution {
public int solution(int[] arr, int divisor) {
int[] answer = {};
int count = 0, answercount = 0;
for(int i = 0; i < arr.length; i++) {
if(arr[i] % divisor == 0) {
count++;
}
}
if(count > 0) {
answer = new int[count];
for(int i = 0; i < arr.length; i++) {
if(arr[i] % divisor == 0) {
answer[answercount] = arr[i];
answercount++;
}
}
}else {
answer = new int[1];
answer[0] = -1;
}
Array.sort(answer); // 오름차순 정렬
return answer;
}
}