public static void printDuplicats(int[] arr){
        boolean zeroPresent = false;
        for(int i = 0; i < arr.length; i++){
            if(arr[Math.abs(arr[i])] > 0){
                arr[Math.abs(arr[i])] = -arr[Math.abs(arr[i])];
            }else if(arr[Math.abs(arr[i])] < 0){
                System.out.print(Math.abs(arr[i]) + " ");
            }else{
                if(zeroPresent == false)
                    zeroPresent = true;
                else
                    System.out.print(Math.abs(arr[i]) + " ");
            }
        }
    }