Write a Java program to check if a given string is a valid palindrome permutation.

Here’s a Java program to check if a given string is a valid palindrome permutation:

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class PalindromePermutation {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a string: ");
        String str = scanner.nextLine();
        boolean isValidPalindromePermutation = checkPalindromePermutation(str);
        if (isValidPalindromePermutation) {
            System.out.println(str + " is a valid palindrome permutation.");
        } else {
            System.out.println(str + " is not a valid palindrome permutation.");
        }
    }

    public static boolean checkPalindromePermutation(String str) {
        Map charCountMap = new HashMap<>();
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (ch != ' ') {
                charCountMap.put(ch, charCountMap.getOrDefault(ch, 0) + 1);
            }
        }
        int oddCount = 0;
        for (int count : charCountMap.values()) {
            if (count % 2 != 0) {
                oddCount++;
            }
        }
        return oddCount <= 1;
    }
}

In this program, we first take user input for a string. We then call the `checkPalindromePermutation()` method to check if the string is a valid palindrome permutation.

A palindrome permutation is a string that can be rearranged to form a palindrome. A palindrome is a string that is the same when read forwards or backwards. For example, "racecar" is a palindrome, and "carerac" is a valid palindrome permutation of "racecar".

The `checkPalindromePermutation()` method takes a string as a parameter and returns a boolean indicating whether the string is a valid palindrome permutation. We first create a hashmap `charCountMap` to store the count of each character in the string. We use a for loop to iterate over each character in the string and add it to the hashmap. We ignore whitespace characters. We then use another for loop to iterate over the values of the hashmap and count the number of odd counts. If the number of odd counts is less than or equal to 1, then the string is a valid palindrome permutation.

At the end of the program, we print out whether the string is a valid palindrome permutation or not.