My problem as the title indicates I want to know if the first character of a String is a number 9. I have the following code but I want to know if it can be optimized:
String palabra = "9394";
if(palabra != null && palabra.contains("9")){
int index = palabra.indexOf("9");
if(index == 0){
System.out.println("9 es la primera letra");
}
}