Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;

public class Main {

    public static Integer[] findAllIndexes(String str, String searchStr) {
        List<Integer> list = new ArrayList<Integer>();

        int index = str.indexOf(searchStr);
        while (index >= 0) {
            list.add(index);
            index = str.indexOf(searchStr, index + searchStr.length());
        }
        return list.toArray(new Integer[list.size()]);
    }
}