0
就像標題所說,我必須將double[]
轉換爲long[]
,但我不知道該怎麼做。Convert double [] to long []
我試試這個:
double[] ids = getIds(); // The ids I'm getting return in double format
List<Long> myArray = new ArrayList<Long>();
for (double _ids : ids) {
myArray.add((long)_ids);
}
System.out.println(myArray); // Works! the list is now long, I can print also in myArray.toArray()
// Now I need pass this on a long[] array for the system wich request the data
// Receive "getStringsById(String string, long... Ids)"
我真的很感激幫助。
謝謝你的時間。
你爲什麼直接創建'List'而不是''''''''? –
一個'清單'不是'長[]' –
nachokk