I've tested the method with various cases and can give the expected results, but just can't pass the validator. Any one can help?

package com.codegym.task.task35.task3513;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
int[] tiles = {4, 4, 4, 0};
mergeTiles(tiles);
for (int i : tiles) {
System.out.print(i + ", ");
}
}
private static void consolidateTiles(int[] tiles) {
List<Integer> temp = new ArrayList<>();
for (int i = 0; i < tiles.length; i++) {
if (tiles[i] != 0)
temp.add(tiles[i]);
}
for (int j = 0; j < temp.size(); j++) {
tiles[j] = temp.get(j);
}
for (int j = temp.size(); j < tiles.length; j++) {
tiles[j] = 0;
}
}
private static void mergeTiles(int[] tiles) {
int n = tiles.length;
for (int i = 0; i < n - 1; i++) {
if (tiles[i] == tiles[i+1]) {
int newValue = tiles[i] * 2;
tiles[i] = newValue;
for (int j = i + 1; j < n - 1; j++) {
tiles[j] = tiles[j+1];
}
tiles[n-1] = 0;
}
}
}
}