Hello i want to convert int Array into Required Format.
i have int array and how to convert it ? i want this String format
int a = [1,2,3,4]
list a = [1,2,3,4]
String = ["1","2","3"];
Hello i want to convert int Array into Required Format.
i have int array and how to convert it ? i want this String format
int a = [1,2,3,4]
list a = [1,2,3,4]
String = ["1","2","3"];
You can iterate over int[]
and convert to String[]
.
int[] a = new int[]{1, 2, 3, 4};
String[] convertedArr = new String[a.length];
for (int i = 0; i < a.length; i++) {
convertedArr[i] = String.valueOf(a[i]);
}
try this
String res = Arrays.toString(a).replaceAll("(\\d+)", "\"$1\"")