Following your code, only I made some changes to make this work.
class PR{
public static void main(String[] args) {
int[] x = {10, 11, 23, 25, 22, 30, 10, 11, 25, 22};
int len = x.length;
for (int i = 0; i < x.length; i++) {
System.out.print(x[i] + ",");
}
for (int i = x.length - 1; i > 0; i--) {
for (int j = i - 1; j >= 0;j--) {
if (x[j] == x[i]) {
for (int k = j; k < len - 1; k++) {
x[k] = x[k + 1];
}
len--;
}
}
}
int[] y = new int[len];
for (int i = 0; i < len; i++) {
y[i] = x[i];
}
System.out.println("\nafter deleting duplicate element:");
for (int i = 0; i < y.length; i++) {
System.out.print(y[i] + ",");
}
}
}
Of course I don't say that this is the best solution but, with your idea this work, only take a look some details that fail in your original code. Hope this help.