Q:

How do I fix my java method to correctly iterate through string?

I need some major help.
My assignment is to recognize a lowercase string and return a true or false statement despite the presence of other characters or words. So far, I'm able to recognize the string in all lowercase, but my code still returns a TRUE value if the word is all uppercase; I only want it to recognize the lowercase values.
The assignment:
Write a program that takes in a string line and prints true if letters of my name (“john”) have appeared in the string in the same order, all in lowercase. Please note that there might be other characters between the letters of my name.
Here's my code:
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        boolean output = Check();
        if (output == true) {
            System.out.println("true");
        }

        else if (output == false) {
            System.out.println("false");
        }
    }

    public static boolean Check() {
        String random;
        Scanner sc = new Scanner(System.in);
        random = sc.nextLine();
        String word = "john";

        for (int i = 0; i < word.length(); i++) {
            if (random.contains(word.substring((i)))) {
                return true;
            }
        }
        if (random.contains("JOHN")) {
            return false;
        }
        return false;
    }
}

Any help would be great thanks.
Some sample outputs:
Sample Input 1:
hello John
Sample Output 1:
false
Sample Input 2:
j123o23h56n
Sample Output 2:
true
Sample Input 3:
joh'n
Sample Output 3:
true
Sample Input 4:
ho0jn
Sample Output 4:
false
Sample Input 5:
J2j#@oh123$NNNnn
Sample Output 5:
true

A:

You need to write a logic where you pick each char from "john" string and compare it in order whether all of them occurred in that order or not. The moment it finds all the characters are found in the input string, it immediately return true without the need to further scan the input string. You may write something like this,
public static boolean Check() {
    String random;
    Scanner sc = new Scanner(System.in);
    random = sc.nextLine();
    String word = "john";
    sc.close();

    int findIndex = 0;
    char findChar = word.charAt(findIndex);
    for (char c : random.toCharArray()) {
        if (findChar == c) {
            findIndex++;
            if (findIndex == word.length()) {
                return true;
            }
            findChar = word.charAt(findIndex);
        }
    }
    return false;
}

