public class Test{
public static void main(String[] args) {
String s = "12,35,11";
String[] s1 = s.split(",");
Long[] l = new Long[s1.length];
for( int i = 0; i < l.length; i++){
l[i] = new Long(s1[i]);
}
//输出转换结果
for( int i = 0; i < l.length; i++){
System.out.println(l[i]);
}
}
}
String[] arr=(12,35,11).split(",")
然后转化一下就行了!
String [] array = ("12,35,11").split(",");
long [] long_array = array.length;
for(int i=0;i
long_array[i] = Long.parseLong(array[i]);
}
package cn.hit.edu.lxc;
public class awsd {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String[] s = ("12,35,11").split(",");
Long[] l = new Long[s.length];
for( int i = 0; i < l.length; i++){
l[i] = new Long(s[i]);
System.out.println(l[i]);
}
}
}