String value = "true";
boolean b = Boolean.parseBoolean(value);
System.out.println(b);
Read more: https://www.java67.com/2018/03/java-convert-string-to-boolean.html#ixzz6HF3C1ERb
boolean bool = Boolean.parseBoolean(str);
boolean boolAnswer;
//answer represents the string you want to convert to boolean
String answer;
answer = "yes";
//compares given variable (answer) to defined true value (yes).
boolAnswer = answer.equals("yes"); //boolAnswer is true
answer = "no" //or anything that isn't "yes", including null
boolAnswer = answer.equals("yes") //boolAnswer is false