Java tutorial
//package com.java2s; /** * Apache License, Version 2.0 * http://www.apache.org/licenses/LICENSE-2.0.html * * */ public class Main { public static boolean isToStringable(Object valueObj) { try { if (valueObj.getClass().getPackage().getName().startsWith("java.lang")) return true; } catch (Exception ex) { ex.printStackTrace(); } return false; } }