Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How java converts int array into string
How java converts int array into string
Package com.baidu.string;

Public class Demo 1_String {

Public static void main(String[] args) {

int[]arr= { 1,2,23,4,5 }; //An array of type int to be converted

string s 1 = " "; //define an empty string

string buffer sb = new string buffer(s 1); //Create the stringbuffer area object sb and pass in the s 1 object (if the buffer is not used, the array element will not be added and the String object will be regenerated).

for(int I = 0; I < array length; i++) {

Someone adds (arr [I]); //Traverse the int array and append to SB;

}

string S2 = sb . tostring(); //Returns the toString () of the buffer object, that is, the result string.

system . out . println(S2);

}

}