1 2 |
String[] arr = new String[]{"s1","s2","s3"}; List<String> list = Arrays.asList(arr); |
1 2 3 4 5 |
List<String> list = new ArrayList<String>(); list.add("s1"); list.add("s2"); list.add("s3"); String[] arr = list.toArray(new String[list.size()]); |
String.valueOf()
将字符数组转换成字符串
1 2 3 4 5 6 7 |
void (){ char[] s={'A','G','C','T'}; String st=String.valueOf(s); System.out.println("This is : "+st); } >> This is : AGCT |
1 2 3 4 5 6 7 8 9 10 |
String str="AGCT"; char[] s=str.toCharArray(); for (int i=0;i<str.length();i++){ System.out.println("This s[i] "+i+s[i]); } This s[i] 0 A This s[i] 1 G This s[i] 2 C This s[i] 3 T |
from:https://blog.csdn.net/qq_41076577/article/details/106909006