Unicode has a set of characters that will let you produce fractions without having to do special formatting, e.g., ⁴⁄₉ or ⁵⁶⁄₁₀₀.
You could set up an array of superscript digits, and an array of subscript digits, and convert your numbers to strings of these digits, and then combine them with the fraction slash in between.
Advantages are that it's more general (you can use the code in other contexts), and the result will tend to look better than if you tried to reproduce it using HTML formatting. Of course, you need to have Unicode fonts on your system, but most systems do these days.
A possible implementation in code:
public String diagonalFraction(int numerator, int denominator) {
char numeratorDigits[] = new char[]{
'\u2070','\u00B9','\u00B2','\u00B3','\u2074',
'\u2075','\u2076','\u2077','\u2078','\u2079'};
char denominatorDigits[] = new char[]{
'\u2080','\u2081','\u2082','\u2083','\u2084',
'\u2085','\u2086','\u2087','\u2088','\u2089'};
char fractionSlash = '\u2044';
String numeratorStr = new String();
while(numerator > 0){
numeratorStr = numeratorDigits[numerator % 10] + numeratorStr;
numerator = numerator / 10;
}
String denominatorStr = new String();
while(denominator > 0){
denominatorStr = denominatorDigits[denominator % 10] + denominatorStr;
denominator = denominator / 10;
}
return numeratorStr + fractionSlash + denominatorStr;
}