Here you can find the source of getMergedLine(String lineOne, String lineTwo, int insertingIndex)
static String getMergedLine(String lineOne, String lineTwo, int insertingIndex)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; public class Main { static String getMergedLine(String lineOne, String lineTwo, int insertingIndex) { ArrayList<String> lstLineOne = new ArrayList<String>( Arrays.asList(lineOne.split(","))); ArrayList<String> lstLineTwo = new ArrayList<String>( Arrays.asList(lineTwo.split(","))); for (int i = 0; i < lstLineTwo.size(); i++) { lstLineOne.add(insertingIndex + i, lstLineTwo.get(i)); }/*from ww w . j a v a 2 s . c o m*/ return strArrayListToString(lstLineOne); } static String strArrayListToString(ArrayList<String> lstLine) { String line = ""; for (int i = 0; i < lstLine.size(); i++) { line = line + lstLine.get(i); if (i != lstLine.size() - 1) line = line + ","; } return line; } }