Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.util.Log;

import java.util.ArrayList;

public class Main {
    public static int[] splitToIntArray(String s) {
        int ai1[];
        if (s == null) {
            ai1 = null;
        } else {
            String as[] = s.split(":");
            ArrayList arraylist = new ArrayList();
            int i = as.length;
            int j = 0;
            do {
                if (j >= i)
                    break;
                String s1 = as[j];
                if (s1 != null && s1.length() > 0)
                    try {
                        arraylist.add(Integer.valueOf(Integer.valueOf(s1).intValue()));
                    } catch (Exception exception) {
                        exception.printStackTrace();
                        Log.e("MicroMsg.Util", "invalid port num, ignore");
                    }
                j++;
            } while (true);
            int ai[] = new int[arraylist.size()];
            for (int k = 0; k < ai.length; k++)
                ai[k] = ((Integer) arraylist.get(k)).intValue();

            ai1 = ai;
        }
        return ai1;
    }
}