Java Vector to String vectorToString(int[] v)

Here you can find the source of vectorToString(int[] v)

Description

Creates and returns a formatted string representation of the input vector v

License

Open Source License

Parameter

Parameter Description
v An input vector to get its formatted string representation

Return

A formatted string of the input vector: [a, b, c..]

Declaration

public static String vectorToString(int[] v) 

Method Source Code

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

public class Main {
    /**/*from  w ww . j a va  2s .  c o  m*/
     * Creates and returns a formatted string representation of the input vector v
     * @param v An input vector to get its formatted string representation
     * @return A formatted string of the input vector: [a, b, c..] 
     */
    public static String vectorToString(int[] v) {
        String str = "[";

        for (int i = 0; i < v.length; i++)
            str += v[i] + ((i < v.length - 1) ? ", " : "");

        return str + "]";
    }
}

Related

  1. vector2String(Vector v, String delimiter)
  2. vector_to_strings(Vector v)
  3. vectorString(Vector vec)
  4. vectorToNickNameArray(Vector nicksAndPaths)
  5. vectorToString(double[] v)
  6. vectorToStringArray(Vector vector)