How to you code this

Pig Latin, move the consonant cluster from the start of the word to the end of the word; when words begin on a vowel, simply add "-yay", "-way", or "-ay" to the end instead. These are the basic rules, and while they're pretty simple, it can take a bit of practice to get used to them.
Explanation:
The code below shows piglatin in java :
class GFG {
static boolean isVowel(char c) {
return (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' ||
c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
}
static String pigLatin(String s) {
int len = s.length();
int index = -1;
for (int i = 0; i < len; i++)
{
if (isVowel(s.charAt(i))) {
index = i;
break;
}
}
if (index == -1)
return "-1";
return s.substring(index) +
s.substring(0, index) + "ay";
}
public static void main(String[] args) {
String str = pigLatin("graphic");
if (str == "-1")
System.out.print("No vowels found." +
"Pig Latin not possible");
else
System.out.print(str);
}
}