Java simple solution || Faster than 98% online java users
//Please upvote if you like my approach\n\nclass Solution {\n    public List<Integer> findLonely(int[] arr) {\n        ArrayList<Integer> al=new ArrayList<>();\
***//Please upvote if you like my approach***\n```\nclass Solution {\n    public List<Integer> findLonely(int[] arr) {\n        ArrayList<Integer> al=new ArrayList<>();\n        Arrays.sort(arr);\n        if(arr.length==1){\n            al.add(arr[0]);\n            return al;\n        }\n        if(arr[0]+1!=arr[1]&&arr[0]!=arr[1])al.add(arr[0]);\n        if(arr[arr.length-1]-1!=arr[arr.length-2]&&arr[arr.length-1]!=arr[arr.length-2])al.add(arr[arr.length-1]);\n        for(int i=1;i<arr.length-1;i++){\n            if(arr[i]==arr[i-1]||arr[i]==arr[i+1])continue;\n            else if(arr[i-1]+1!=arr[i]&&arr[i+1]-1!=arr[i])al.add(arr[i]);\n        }\n        return al;\n    }\n```
['Java']