Write a Java Function to solve this:

Given two strings s and t, return true if s is a subsequence of t, or false otherwise.

A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not).
Here's a Java function that solves the problem:

```
public boolean isSubsequence(String s, String t) {
    int sIndex = 0;
    int tIndex = 0;
    
    while (sIndex < s.length() && tIndex < t.length()) {
        if (s.charAt(sIndex) == t.charAt(tIndex)) {
            sIndex++;
        }
        tIndex++;
    }
    
    return sIndex == s.length();
}
```

This function uses two index variables, `sIndex` and `tIndex`, to iterate through the characters of the two strings. If the current characters match, `sIndex` is incremented to move on to the next character in `s`. Regardless, `tIndex` is always incremented to move on to the next character in `t`. 

If `sIndex` reaches the end of the `s` string, we know that all of the characters in `s` are present in `t` in their original relative positions, so we return `true`. Otherwise, we return `false`.

Note that this function assumes that `s` and `t` are non-null. To handle null strings, we would need to add additional null checking and return false if either string is null.
Complete the following task based on the instruction and optional input provided.### Instruction:
Write a Java Function to solve this:

Given two strings s and t, return true if s is a subsequence of t, or false otherwise.

A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not).

### Output:
Here's a Java function that solves the problem:

```
public boolean isSubsequence(String s, String t) {
    int sIndex = 0;
    int tIndex = 0;
    
    while (sIndex < s.length() && tIndex < t.length()) {
        if (s.charAt(sIndex) == t.charAt(tIndex)) {
            sIndex++;
        }
        tIndex++;
    }
    
    return sIndex == s.length();
}
```

This function uses two index variables, `sIndex` and `tIndex`, to iterate through the characters of the two strings. If the current characters match, `sIndex` is incremented to move on to the next character in `s`. Regardless, `tIndex` is always incremented to move on to the next character in `t`. 

If `sIndex` reaches the end of the `s` string, we know that all of the characters in `s` are present in `t` in their original relative positions, so we return `true`. Otherwise, we return `false`.

Note that this function assumes that `s` and `t` are non-null. To handle null strings, we would need to add additional null checking and return false if either string is null.