Here you can find the source of convertObjectToString(Object obj)
String
public static String convertObjectToString(Object obj)
//package com.java2s; /*/* w w w . j av a 2 s . c om*/ * %W% %E% %U% * * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { /** Converts the provided object to <code>String</code> */ public static String convertObjectToString(Object obj) { if (obj == null) return ""; String s = ""; if (obj instanceof byte[]) { byte[] bArray = (byte[]) obj; for (int i = 0; i < bArray.length; i++) s += bArray[i] + " "; return s; } if (obj instanceof int[]) { int[] iArray = (int[]) obj; for (int i = 0; i < iArray.length; i++) s += iArray[i] + " "; return s; } if (obj instanceof short[]) { short[] sArray = (short[]) obj; for (int i = 0; i < sArray.length; i++) s += sArray[i] + " "; return s; } return obj.toString(); } }