My code works and does what it is supposed to. However it needs to be more efficient. Could anyone help me tidy this up and show me where I could perhaps not rely on large loops (which it does a lot and slows it down).import java.util.ArrayList;public class PigLatin {  public String translate(String str) {    final String vowels = aeiouAEIOU;    ArrayList<Character> strArray = new ArrayList<Character>();    for (int i = 0; i < str.length(); i++) {       strArray.add(str.charAt(i));    }    // if any digits are found in str, return null    for (int i = 0; i < strArray.size(); i++) {      char current = strArray.get(i);      if (Character.isDigit(current)) {        return null;      }    }    // if str begins with a vowel    for (int vowel = 0; vowel < vowels.length(); vowel++) {      if (strArray.get(0) == vowels.charAt(vowel)) {        return str + way;      }    }    // if str does not begin with a vowel, pass each letter to the end of str    // until a vowel is found and add ay to the end.    boolean isAVowel = false;    int count = 0;    while (!isAVowel) {      char current = strArray.get(count);      if (current != 'a' && current != 'e' && current != 'i' && current != 'o' && current != 'u' && current != 'A' && current != 'E' && current != 'I'          && current != 'O' && current != 'U') {        strArray.add(strArray.size(), current);        strArray.remove(count);      } else {        isAVowel = true;      }    }    strArray.add(strArray.size(), 'a');    strArray.add(strArray.size(), 'y');    String piglatinate = ;    for (char l : strArray) {      piglatinate = piglatinate + l;    }    piglatinate = piglatinate.toLowerCase();    return piglatinate;  }}
Code efficiency - Piglatin
java;performance;strings