convert int array to string java code example

Example 1: int to string java

int x = 3;

Integer.toString(int)

Example 2: converter int array para string java

int[] array = { 1, 2, 3, 4, 5 };
String s = String.join("", IntStream.of(array).mapToObj(String::valueOf).toArray(String[]::new));
System.out.println(s); // 12345

Example 3: java how to cast int to String

int i = 1234; 
String s = String.ValueOf(i)

Example 4: convert integer array to string array

int[] nums = {5,1,2,11,3}; //List or Vector
Arrays.sort(nums); //Collections.sort() for List,Vector
String a=Arrays.toString(nums); //toString the List or Vector
String ar[]=a.substring(1,a.length()-1).split(", ");
System.out.println(Arrays.toString(ar));

Tags:

Cpp Example