using a digitalpin to check for 5v on a wire

Directly give it a connection via some small 150-200ohm resistance and use digital.read() in the code offcourse after setting pin as input.
please make sure the input is max 5v DC.