Here you can find the source of toCharacter(Object obj)
public static char toCharacter(Object obj)
//package com.java2s; //License from project: Open Source License public class Main { public static char toCharacter(Object obj) { return toCharacter(obj, (char) ' '); }/* www. ja v a 2 s. c om*/ public static char toCharacter(Object obj, char defaultValue) { if (obj == null) { return defaultValue; } String str = obj.toString().trim(); if (str.length() == 0) { return defaultValue; } return (char) str.toCharArray()[0]; } public static String toString(Object value) { if (value == null) { return ""; } return value.toString().trim(); } }