```
public class Solution {
public boolean containsDuplicate(int[] nums) {
if (nums == null || nums.length < 2) return false;
Arrays.sort(nums);
int n = nums[0];
for (int i = 1; i < nums.length; i++) {
final int m = nums[i];
if (n == m) return true;
n = m;
}
return false;
}
}
```