Convert Array to string in Java

By using Arrays.toString() this method to covert Array to string in Java.

public static String toString(boolean[] a)
Returns a string representation of the contents of the specified array. The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(boolean). Returns "null" if a is null.

Parameters: a - the array whose string representation to return
Returns: a string representation of a

No comments:

Post a Comment