split string To Long Array - Android java.lang

Android examples for java.lang:String Split

Description

split string To Long Array

Demo Code

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;

public class Main{


    public static long[] splitToLongArray(String string, String delimiter) {
        List<String> stringList = splitToStringList(string, delimiter);

        long[] longArray = new long[stringList.size()];
        int i = 0;
        for (String str : stringList) {
            longArray[i++] = Long.parseLong(str);
        }/*from ww w  .  j  a  v  a  2 s .c om*/
        return longArray;
    }

}

Related Tutorials