Java Array to String arrayToString(int[][] array)

Here you can find the source of arrayToString(int[][] array)

Description

array To String

License

Open Source License

Declaration

public static String arrayToString(int[][] array) 

Method Source Code

//package com.java2s;
/* ArrayUtil.java 1.0 2010-2-2
 * //from   w w w .j  a va  2s.  c  om
 * Copyright (c) 2010 by Chen Zhiwu
 * All rights reserved.
 * 
 * The copyright of this software is own by the authors.
 * You may not use, copy or modify this software, except
 * in accordance with the license agreement you entered into 
 * with the copyright holders. For details see accompanying license
 * terms.
 */

import java.io.ByteArrayOutputStream;

public class Main {
    public static String arrayToString(int[][] array) {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[0].length; j++) {
                out.write(array[i][j]);
            }
        }
        return new String(out.toByteArray());
    }

    public static String arrayToString(int[] array) {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        for (int i = 0; i < array.length; i++) {
            out.write(array[i]);
        }
        return new String(out.toByteArray());
    }
}

Related

  1. arrayToString(int[] array)
  2. arrayToString(int[] ary)
  3. arrayToString(int[] c, String separator)
  4. arrayToString(int[] s)
  5. arrayToString(int[] subset)
  6. arrayToString(Object arbitraryArray)
  7. arrayToString(Object array)
  8. arrayToString(Object array)
  9. arrayToString(Object array)