Most Java devs would prefere `if (envVar.startsWith("$") || envVar.startsWith("%"))` here as it is more readable. But that is a matter of taste. Your code works as well, if you can guarantee that envVar is never empty (`startsWith` handles that case for you)