I know it is a simple question and I know the way to do it, only need of mine here is Performance and with less time as possible it should do.
I am getting input as
long l = 149; I want to make this number of size 10 with additional numbers to be added at starting to make it of 10 digit. above number should get converted to,
0000000149. Similarly,
1 -> 0000000001 13 -> 0000000013 888888 -> 0000888888 1. I tried with loop, like checking number length, subtracting number length by 10, then adding number of zero as the subtraction result i got.
2 Already created array like
arr[0, 00, 000, 0000, 00000, 000000, 0000000, 00000000, 000000000, 0000000000]; here I am doing same thing, subtracting my number length with 10 and getting arr[numberLenth -10] + number
I am getting desired result.
I want to make sure to check is there any better solution to this like using bitwise operator for such requirement?
Thanks