引入apache 的pom
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>
String[] str = {"1","2"};
Long[] ids= (Long[])ConvertUtils.convert(str,Long.class);
传入其他封装类型即可随意转换