Java - Write code to create a function and convert 'true' and 't' to boolean Value

Requirements

Write code to create a function and convert 'true' and 't' to boolean Value

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String tfString = "book2s.com";
        System.out.println(booleanValue(tfString));
    }/*w  w  w .  ja  va  2  s . co  m*/

    public static boolean booleanValue(String tfString) {
        String trimmed = tfString.trim().toLowerCase();
        return trimmed.equals("true") || trimmed.equals("t");
    }

    public static String toLowerCase(String str) {
        return str == null ? null : str.toLowerCase();
    }
}