Java tutorial
//package com.java2s; public class Main { public static Object wrapperClassCloner(Object value) { if (value instanceof Double) return new Double(((Double) value).doubleValue()); else if (value instanceof Float) return new Float(((Float) value).floatValue()); else if (value instanceof Long) return new Long(((Long) value).longValue()); else if (value instanceof Boolean) return new Boolean(((Boolean) value).booleanValue()); else if (value instanceof Integer) return new Integer(((Integer) value).intValue()); else return null; } }