Java-Convert Integer Array to String

Convert Integer Array to String

There is an even easier way to convert integer array to String, using the toString method of the Arrays class. The call Arrays.toString(array) returns a string containing the array elements, enclosed in brackets and separated by commas, such as “[20,40,60,80,90]”.

Program

Program Source

import java.util.Arrays;

public class Javaapp {
 
    public static void main(String[] args) {
     
        int[] values = {20,40,60,80,90}:
     
        String get_values = Arrays.toString(values);
     
        System.out.println("values = "+get_values);
    }
}

Leave a Comment