I'm guessing that your snippet uses the j[] array to simulate incoming bits on the serial. If that's the case and you want to turn those bits into a digital value then you'd do this:
int j[8];
int i =0, k=0;
void setup()
{
j[0]=0; j[1] =0; j[2] =0; j[3] = 1; j[4] =0; j[5] = 1; j[6] = 0; j[7] =1;
//Serial.begin(9600);
}
void loop() {
for(i=0;i<8;i++) {
k = k + j[i] << (7-i);
}
Serial.println("");
Serial.println(k);
delay(2000);
k=0;
}
That code should be equivilent to yours but using shift operators and without l. You don't need it. If l is going down at the same rate that i is going up then derive it from i.