Here you can find the source of toString(Object value)
Parameter | Description |
---|---|
value | a parameter |
public static String toString(Object value)
//package com.java2s; /*/*from www . j a v a2 s.c o m*/ * Copyright (c) 2012 Diamond Light Source Ltd. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ import java.util.Arrays; public class Main { /** * Deals with primitive arrays * @param value */ public static String toString(Object value) { if (value == null) return null; if (value instanceof short[]) { return Arrays.toString((short[]) value); } else if (value instanceof int[]) { return Arrays.toString((int[]) value); } else if (value instanceof long[]) { return Arrays.toString((long[]) value); } else if (value instanceof char[]) { return Arrays.toString((char[]) value); } else if (value instanceof float[]) { return Arrays.toString((float[]) value); } else if (value instanceof double[]) { return Arrays.toString((double[]) value); } else if (value instanceof boolean[]) { return Arrays.toString((boolean[]) value); } else if (value instanceof byte[]) { return Arrays.toString((byte[]) value); } else if (value instanceof Object[]) { return Arrays.toString((Object[]) value); } return value.toString(); } }