How can i set the pin?

This is a rare case where I often utilize white space. Some compilers enforce a maximum of 255 characters per line, in any case, it is easier to read:

if (digitalRead(1) == HIGH
                   && digitalRead(2) == HIGH
                   && digitalRead(3) == HIGH
                   && digitalRead(4) == HIGH
                   { ...

If you have a ridiculous number of pins, you can do it programmatically.

int result = LOW;
for (i = 0; i < numPins; i++) {
  result &= digitalRead( pins[i] );
}