Wie druckst du doppelte Zeichen aus einer Zeichenfolge?

import java.util.Scanner;
public class uniqueCharacters {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("Enter a string:");
        String str = scan.nextLine();

        char currentChar;
        int count=0;
        String duplicateCharacter="";
        for (int i = 0; i < str.length(); i++) {
            currentChar=str.charAt(i);

            for (int j = 0; j < str.length(); j++) {
                if (currentChar==str.charAt(j)) {
                    count++;
                }
            }
            
            if(count!=1 && !duplicateCharacter.contains(currentChar+"")){

                duplicateCharacter+=currentChar+" ";
            }
            count=0;
        }

        System.out.println(duplicateCharacter);
    }
}
Zhouri