Converting String Array to Integer Array Example Java
Java Program to Convert String Array to Integer Array:
In this below program we have converted string array to integer array.
package com.ngdeveloper; public class StringArrayToIntArray { public static void main(String[] args) { String[] strArray = { "10", "20", "30", "40", "50" }; int[] intArray = new int[strArray.length]; for (int i = 0; i < strArray.length; i++) { intArray[i] = Integer.parseInt(strArray[i]); } for (int i = 0; i < intArray.length; i++) { System.out.println("Integer Array Values :: " + intArray[i]); } } }
Output:
Integer Array Values :: 10 Integer Array Values :: 20 Integer Array Values :: 30 Integer Array Values :: 40 Integer Array Values :: 50