Java CSV String Create toCSV3_2(double[][][] array, int index1, int index3)

Here you can find the source of toCSV3_2(double[][][] array, int index1, int index3)

Description

to CS_

License

Open Source License

Declaration

public static String toCSV3_2(double[][][] array, int index1, int index3) 

Method Source Code

//package com.java2s;
/**    /*w  ww  . jav a 2s  . co m*/
  * Copyright (C) 2006, Laboratorio di Valutazione delle Prestazioni - Politecnico di Milano
    
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) 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 General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */

public class Main {
    public static String toCSV3_2(double[][][] array, int index1, int index3) {
        int len2 = array[index1].length;
        if (len2 == 0) {
            return "";
        }
        StringBuffer s = new StringBuffer();

        s.append(Double.toString(array[index1][0][index3]));

        for (int i = 1; i < len2; i++) {
            s.append(";").append(Double.toString(array[index1][i][index3]));
        }
        return s.toString();
    }

    public static String toString(Object[] array) {
        StringBuffer s = new StringBuffer("[ ");
        for (Object element : array) {
            if (element == null) {
                s.append("null");
            } else {
                s.append(element.toString());
            }
            s.append(" ");
        }
        s.append("]");

        return s.toString();
    }

    public static String toString(int[] array) {
        StringBuffer s = new StringBuffer("[ ");
        for (int element : array) {
            s.append(element).append(" ");
        }
        s.append("]");

        return s.toString();
    }

    public static String toString(double[] array) {
        StringBuffer s = new StringBuffer("[ ");
        for (double element : array) {
            s.append(element).append(" ");
        }
        s.append("]");

        return s.toString();
    }
}

Related

  1. getCsv(Collection collection)
  2. getCSVPhrase(Collection objects)
  3. toCSV(int[] a)
  4. toCsv(Object[] arr, String format)
  5. toCsv(String value)
  6. toCSVBuffer(byte barr[])
  7. toCsvLine(final String[] parts)
  8. toCSVString(double[] d)
  9. toCsvString(Object object)