Convert String to Int or Int to String in Java and Int array to String

Int to String-

Use toString function to convert Int to String

public static void main1(String[] args )
	{
		int number = 100;
		String strNumber = Integer.toString( number );
		System.out.println("Number	:	"+strNumber);
	}

String to Int-

Use parseInt function to convert String to Int

public static void main( String[] args )
	{
		String strNumber = "abc";
		int number = Integer.parseInt( strNumber );
		System.out.println("Number	:	"+number);		
	}

Convert Int array to String-

import java.util.Arrays;

int[] array = new int[] { 10, 20, 30, 40 };
System.out.println(Arrays.toString(array));

Convert String array to Int –

String [] str = {"10", "20", "30", "40"};
      for(int i=0; str.length; i++) {
         arr[i] = Integer.parseInt(str[i]);
      }
      System.out.println(Arrays.toString(arr));
   }