You could use the characters a
and ⓐ
to determine the offset values for the alphabet. In combination with a StringBuilder
it should be rather efficient. Of course you would likely have to be very strict about the input string being only alphabet characters.
This is the code for what I described above:
public class Bubbled {
public static void main(String[] args) {
char bubbledA = 'ⓐ';
int lowerCaseOffset = bubbledA - 'a';
int upperCaseOffset = bubbledA - 'A';
String input = "Hello";
StringBuilder bubbledOutput = new StringBuilder();
for (Character c : input.toCharArray()) {
if (Character.isUpperCase(c)) {
bubbledOutput.append((char)(c + upperCaseOffset));
} else {
bubbledOutput.append((char)(c + lowerCaseOffset));
}
}
System.out.println(bubbledOutput.toString());
}
}
Output
ⓗⓔⓛⓛⓞ