We spoke with an eye-witness who saw Remar approach the man outside of an L.A. grocery store on Friday ... and noticed he was bleeding profusely from his head.
So Remar, being a former EMT and an all-around nice guy, went into the store ... bought a bandage and antiseptic cream ... went back to the homeless man and cleaned and dressed the wound.
We're told Remar also gave the man advice on how to keep the wound from becoming infected.
TMZ spoke to Remar's rep ... who told us James sprung into action simply because he felt it was the right thing to do.
The Code of Harry ... redefined (Dexter fans will understand).