Here you can find the source of arrayToJava(double[] v, int off, int len, String name)
static String arrayToJava(double[] v, int off, int len, String name)
//package com.java2s; /*// w w w .j a va 2s . c o m * Copyright (c) 2014, Massachusetts Institute of Technology * Released under the BSD 2-Clause License * http://opensource.org/licenses/BSD-2-Clause */ public class Main { static String arrayToJava(double[] v, int off, int len, String name) { String dec = " private static final double[] " + name + " = { "; StringBuilder s = new StringBuilder(); for (int i = 0; i < dec.length(); i++) { s.append(' '); } String prefix = s.toString(); s = new StringBuilder(dec); for (int i = 0; i < len; i++) { if (i > 0) { s.append(",\n").append(prefix); } s.append(v[i + off]); } s.append("\n };"); return s.toString(); } }