Here you can find the source of intArrayToString(int[] array)
Parameter | Description |
---|---|
array | the array |
public static String intArrayToString(int[] array)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww . j ava 2s. c o m * Creates a string representation of the given array of type int[] (this representation * can be parsed using the method parseIntegerArray). * @param array the array * @return string representation of the given array */ public static String intArrayToString(int[] array) { StringBuilder sb = new StringBuilder(); sb.append("["); for (int a : array) { sb.append(a).append(", "); } if (sb.lastIndexOf(", ") != -1) sb.delete(sb.lastIndexOf(", "), sb.length()); sb.append("]"); return sb.toString(); } }