Java - Write code to search index Of a char inside a string

Requirements

Write code to search index Of a char inside a string

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String str = "book2s.com";
        char searchChar = 'a';
        int startPos = 2;
        System.out.println(indexOf(str, searchChar, startPos));
    }/*ww  w. j a v a 2  s  .com*/

    public static int indexOf(String str, char searchChar, int startPos) {
        if (isEmpty(str))
            return -1;
        else
            return str.indexOf(searchChar, startPos);
    }

    public static boolean isEmpty(String str) {
        return str == null || str.length() == 0;
    }
}