Here you can find the source of addArray(StringBuffer RCode, String name, T[] array, boolean useEquals, boolean isString)
public static <T> void addArray(StringBuffer RCode, String name, T[] array, boolean useEquals, boolean isString)
//package com.java2s; /*/*from www . j a v a 2 s . c o m*/ * RCaller, A solution for calling R from Java Copyright (C) 2010-2015 Mehmet Hakan Satman This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. * * * Mehmet Hakan Satman - mhsatman@yahoo.com * http://www.mhsatman.com * Google code project: https://github.com/jbytecode/rcaller * Please visit the blog page with rcaller label: * http://stdioe.blogspot.com.tr/search/label/rcaller */ public class Main { public static <T> void addArray(StringBuffer RCode, String name, T[] array, boolean useEquals, boolean isString) { if (useEquals) { RCode.append(name).append("=").append("c("); } else { RCode.append(name).append("<-").append("c("); } for (int i = 0; i < array.length; i++) { if (isString) { RCode.append("\"").append(array[i]).append("\""); } else { RCode.append(array[i]); } if (i < array.length - 1) { RCode.append(", "); } } if (useEquals) { RCode.append(")"); } else { RCode.append(");").append("\n"); } } }