String[]转换Long[]

public static Long[] StringArray2LongArray(String[] stringArray)
    {
        List list=new ArrayList<>();
        for (String str: stringArray) {
            try {
                list.add(Long.parseLong(str));
            } catch (NumberFormatException e) {
                e.printStackTrace();
            }
        }
        Long[] longArray=list.toArray(new Long[list.size()]);
        return longArray;
    }

你可能感兴趣的:(String[]转换Long[])