0

I am trying to format add a zero to any value less than 10, so 09. So at the end of the loop, the "total" value will format to numbers less than 10 with a zero.

Here is my code but it still isn't working :

int total = 0;

String holder = val + "-" + s + "-" + frame + "-";
    for (int i = 0; i < holder.length(); i++)
    {
        int mod = holder.charAt(i);
        total += mod;
        total = total%100; //get remainder
    }

string totalchk = String.format("%02d", total);
Flexo
  • 87,323
  • 22
  • 191
  • 272
newborn
  • 159
  • 1
  • 2
  • 12

0 Answers0