Here you can find the source of multiply(String[] tempResult, int nextIndex, String[][] pys)
private static String[] multiply(String[] tempResult, int nextIndex, String[][] pys)
//package com.java2s; public class Main { private static String[] multiply(String[] tempResult, int nextIndex, String[][] pys) { String[] next = pys[nextIndex]; int pl = tempResult.length; int npl = next.length; String[] result = new String[pl * npl]; int count = 0; for (int i = 0; i < pl; i++) { for (int j = 0; j < npl; j++) { result[count] = tempResult[i] + next[j]; count++;//from w ww . j av a 2 s. c o m } } ++nextIndex; if (nextIndex < pys.length) { return multiply(result, nextIndex, pys); } else { return result; } } }