String myName = "Fred F. Flintstone";
StringBuffer myInitials = new StringBuffer();
int length = myName.length();
for (int i = 0; i < length; i++) {
if (Character.isUpperCase(myName.charAt(i))) {
myInitials.append(myName.charAt(i));
}
}
System.out.println("My initials are: " + myInitials);