The idea is that increase n-1 element by 1 equals to decrease 1 element by 1.

```
public int minMoves(int[] nums) {
int min = Integer.MAX_VALUE;
for (int i : nums) {
min = Math.min(min, i);
}
int res = 0;
for (int i : nums) {
res += i - min;
}
return res;
}
```