Java Array arrayString(int[] data)

Here you can find the source of arrayString(int[] data)

Description

array String

License

Open Source License

Declaration

public static String arrayString(int[] data) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String arrayString(int[] data) {
        if (data == null)
            return null;
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            buf.append(data[i] + " ");
        }//from www .j  ava  2 s  .  c om
        return buf.toString();
    }

    public static String arrayString(int[][] data) {
        if (data == null)
            return null;
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            buf.append(arrayString(data[i]) + "\n");
        }
        return buf.toString();
    }

    public static String arrayString(int[][][] data) {
        if (data == null)
            return null;
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            buf.append(arrayString(data[i]) + "\n");
        }
        return buf.toString();
    }

    public static String arrayString(double[] data) {
        if (data == null)
            return null;
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            buf.append(data[i] + " ");
        }
        return buf.toString();
    }

    public static String arrayString(double[][] data) {
        if (data == null)
            return null;
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            buf.append(arrayString(data[i]) + "\n");
        }
        return buf.toString();
    }

    public static String arrayString(String[] data) {
        if (data == null)
            return null;
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            buf.append(data[i] + " ");
        }
        return buf.toString();
    }

    public static String arrayString(String[][] data) {
        if (data == null)
            return null;
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            for (int j = 0; j < data[i].length; j++) {
                buf.append(data[i][j] + " ");
            }
            buf.append("\n");
        }
        return buf.toString();
    }

    public static String arrayString(Object[] data) {
        if (data == null)
            return null;
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            buf.append(data[i] + " ");
        }
        return buf.toString();
    }

    public static String arrayString(Object[][] data) {
        if (data == null)
            return null;
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            for (int j = 0; j < data[i].length; j++) {
                buf.append(data[i][j] + " ");
            }
            buf.append("\n");
        }
        return buf.toString();
    }
}

Related

  1. arraySame(Object[] array1, Object[] array2)
  2. arraysConvert(String[] src, int column)
  3. arraySeekDelete(final T[] arr, final T[] dest, final T... dels)
  4. arrayStr(int[] A)
  5. arrayString(double[] test)
  6. arrayStringR(double[] data)
  7. arrayTransfer(int[] ids)
  8. arrayType(String type)
  9. arrayTypeToZeroLengthArray(String arrayType)