Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2004 Actuate Corporation. * 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 * * Contributors: * Actuate Corporation - initial API and implementation *******************************************************************************/ import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main { /** * * @return */ public static Object[] flatternMultipleValues(Object[] values) { if (values == null || values.length == 0) return new Object[0]; List flattern = new ArrayList(); for (int i = 0; i < values.length; i++) { if (values[i] instanceof Object[]) { Object[] flatternObj = (Object[]) values[i]; flattern.addAll(Arrays.asList(flatternMultipleValues(flatternObj))); } else { flattern.add(values[i]); } } return flattern.toArray(); } }