Java Array Output printArray(double[][] in)

Here you can find the source of printArray(double[][] in)

Description

print Array

License

Apache License

Declaration

public static final String printArray(double[][] in) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final String printArray(double[][] in) {
        if (in == null)
            return "null";
        String out = "";
        for (int i = 0; i < in.length; i++) {
            for (int j = 0; j < in[0].length; j++) {
                out += in[i][j] + " ";
            }/*from  w  w w .  j a  v  a  2 s . co m*/
            out += "\n";
        }
        return out;
    }

    public static final String printArray(double[] in) {
        if (in == null)
            return "null";
        String out = "";
        for (int i = 0; i < in.length; i++) {
            out += in[i] + " ";
        }
        return out;
    }

    public static final String printArray(boolean[] in) {
        if (in == null)
            return "null";
        String out = "";
        for (int i = 0; i < in.length; i++) {
            if (in[i])
                out += "1 ";
            else
                out += "0 ";
        }
        return out;
    }

    public static final String printArray(float[][] in) {
        if (in == null)
            return "null";
        String out = "";
        for (int i = 0; i < in.length; i++) {
            for (int j = 0; j < in[0].length; j++) {
                out += in[i][j] + " ";
            }
            out += "\n";
        }
        return out;
    }

    public static final String printArray(float[] in) {
        if (in == null)
            return "null";
        String out = "";
        for (int i = 0; i < in.length; i++) {
            out += in[i] + " ";
        }
        return out;
    }

    public static final String printArray(long[][] in) {
        if (in == null)
            return "null";
        String out = "";
        for (int i = 0; i < in.length; i++) {
            for (int j = 0; j < in[0].length; j++) {
                out += in[i][j] + " ";
            }
            out += "\n";
        }
        return out;
    }

    public static final String printArray(long[] in) {
        if (in == null)
            return "null";
        String out = "";
        for (int i = 0; i < in.length; i++) {
            out += in[i] + " ";
        }
        return out;
    }
}

Related

  1. printArray(char[] array)
  2. printArray(double[] array)
  3. printArray(double[] array, String msgBefore, String msgAfter)
  4. printArray(double[][] in)
  5. printarray(final int[] a)
  6. printArray(final Object[] array, int indent)
  7. printArray(float[] arr)
  8. printArray(int arr[])