Java tutorial
//package com.java2s; //License from project: Open Source License import android.text.TextUtils; import android.util.Log; import java.util.ArrayList; public class Main { @Deprecated private static Long[] getIdArray(String serializedTree) { ArrayList<Long> ids = new ArrayList<>(); String[] digitsOnly = serializedTree.split("[\\[\\],\\s]"); // Split on [ ] , or whitespace chars for (String idString : digitsOnly) { try { if (!TextUtils.isEmpty(idString)) { ids.add(Long.parseLong(idString)); } } catch (NumberFormatException e) { Log.e("widget-subtasks", "error parsing id " + idString, e); } } return ids.toArray(new Long[ids.size()]); } }