android格式化字串(sprintf)

android中 沒有sprintf這個函式
但如果需要格式化字串時怎麼辦呢

使用 String.format()

String result = String.format("%02d", 5);