class Solution {
public int findDuplicate(int[] nums) {
int len = nums.length;
for(int i=0;i<len-1;i++){
for (int k=i+1;k<len;k++){
if (nums[i]==nums[k])
return nums[i];
}
}
return -1;
}
}