Java Array to String arrayToString(float[] arg)

Here you can find the source of arrayToString(float[] arg)

Description

array To String

License

Open Source License

Declaration

public static final String arrayToString(float[] arg) 

Method Source Code

//package com.java2s;
/* //w ww . j av  a  2 s .c  om
  This file is part of JIV2.  
  Copyright (C) 2000, 2001 Chris A. Cocosco (crisco@bic.mni.mcgill.ca),
  2010 Lara Bailey (bailey@bic.mni.mcgill.ca).
    
  JIV2 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.
    
  JIV2 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 JIV2; if not, write to the Free Software Foundation, Inc.,
  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA, 
  or see http://www.gnu.org/copyleft/gpl.html
*/

public class Main {
    public static final String arrayToString(byte[] arg) {

        StringBuffer s = new StringBuffer(arg.toString());
        s.append(" : ");
        for (int i = 0; i < arg.length; ++i) {
            s.append(arg[i]);
            s.append(" ");
        }
        return s.toString();
    }

    public static final String arrayToString(int[] arg) {

        StringBuffer s = new StringBuffer(arg.toString());
        s.append(" : ");
        for (int i = 0; i < arg.length; ++i) {
            s.append(arg[i]);
            s.append(" ");
        }
        return s.toString();
    }

    public static final String arrayToString(float[] arg) {

        StringBuffer s = new StringBuffer(arg.toString());
        s.append(" : ");
        for (int i = 0; i < arg.length; ++i) {
            s.append(arg[i]);
            s.append(" ");
        }
        return s.toString();
    }

    public static final String arrayToString(float[][] arg) {

        StringBuffer s = new StringBuffer(arg.toString());
        s.append(" : ");
        for (int i = 0; i < arg.length; ++i) {
            for (int j = 0; j < arg[i].length; ++j) {
                s.append(arg[i][j]);
                s.append(" ");
            }
        }
        return s.toString();
    }
}

Related

  1. arrayToString(final String[] value)
  2. arrayToString(final String[] values)
  3. arrayToString(final T... data)
  4. arrayToString(final T[] array)
  5. arrayToString(float[] a)
  6. arrayToString(float[][] array)
  7. arrayToString(int[] ar)
  8. arrayToString(int[] arr)
  9. arrayToString(int[] arr)