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