Trying to create an array to find the occurrence of a character in a given String.

```
public static void main(String[] args)
{
  String s1 = "java";
  char ch = 'a';

System.out.println(indexOf(s1, ch));
}

public static int indexOf(String s, char ch)
{
  int count = 0;

  while (count < s.length())
  {
     if (s.charAt(count) == ch)
        return count;

     else
        count += 1;
  }
  return -1;
}

```

So the result is supposed to be 1 3