Ok let me try to understand this. When you say im putting num to 0 every time do you mean.
static long currentSample; // current sensor sample.
static long currentValue; // current sensor value.
int num;
num = 0; <======(This part)
currentValue = 0;
I just took that part out and still getting 4009 on my top line and bottom line is reading correct at 5349.