Well, the above solution isn't the best, and it can be greatly simplified. For organization and efficiency, its best if you have a strip image where each number has the same width(align all the numbers to the right).
If you have an integer score, convert that to a string. Loop through each character in the string and use an approach like this:
1 2 3 4 5 6 7 8
| int sx = 0, sy = 0;
for(int i = 0; i < str.length(); i++) { int pos = Integer.valueOf(str.substring(i, i)); BufferedImage curnum = bitmapfont.getSubImage(pos * fontwidth, 0, fontwidth, fontheight); g.render(curnum, sx, sy, null); sx += fontwidth; } |
Play with that and you'll get what you want.

ok so after trying to implement it i am having some problems. when replacing your str string with my score string this error comes up: Cannot invoke substring(int, int) on the primitive type int .
also could you explain the curnum image to me? i dont understand it too well
