convert Long[] to long[] (primitive) java

后端 未结 5 711
感情败类
感情败类 2021-02-18 13:13

How do i convert Long[] to long[]? For example i know how to convert if it is not array as below.

long ll = (Long)Object[1].longValue()

But how

5条回答
  •  执笔经年
    2021-02-18 13:18

    You could steal a solution based on ArrayUtils

    Long[] longObjects = { 1L, 2L, 3L };
    long[] longArray = ArrayUtils.toPrimitive(longObjects);
    

提交回复
热议问题