for(int j=0; j<blocksize; j++)
{
temp+=number[i];
i++;
}

The problem is, you're messing around with the other loops control variable, and not checking...