charWidth(char ch)
Returns the advance width of the specified character in this Font.
stringWidth(String str)
Returns the total advance width for showing the specified String in this Font.
The advance of a String is the distance along the String’s baseline. This distance is the width that should be used for centering or alignment to the right of the string.
Note that the advance of a String is not necessarily the sum of the advances of its individually measured characters because the width of a character may vary according to its context.
For example, in Arabic text, the form of a character can change to "connect" to other characters. Also, in some scripts, certain strings of characters can be represented by a single form, called a ligature. Individual character measurement is not responsible for these transformations.
Source:
Class Fontmetrics - Docs Oracle