You could also (depending on your shell, which you haven't told us, but it looks like bash)
typeset -Z3 i
This will set the value to be three digits with leading zeros as required. As a caution though, it will use the right-most three digits it your value is higher.
This can be useful sometimes, but can get in the way:-
$ typeset -Z3 i=1234
$ echo $i
234
I hope that this helps,
Robin
Liverpool/Blackburn
UK