Sandman was an interesting problem for both logic and law enforcement. He's a super strong pile of sand, and what that meant varied wildly from day to day and writer to writer. Sometimes he could smash through a bank vault and other times he was helpless against the walls of a vacuum cleaner's bag. Speaking of, that's usually how Spider-Man took care of him.
"Ha ha, really? Wait, is this working!?"
This happened all the time. In the Ultimate Marvel Universe, Sandman was once separated into jars and frozen by Iron Man. Can you imagine being broken up into pieces and kept alive in separate jars? Probably not, but at least you could argue Sandman was unconscious for that. Our Spider-Man from the original Marvel dimension took madness-inducing incarceration to the next level.
Spider-Man theorized that Sandman couldn't have been just a pile of sand, since that makes no goddamn sense. It made slightly more sense that his consciousness had to be contained in one single magic grain of sand, and all they had to do was capture it. So he hatched a plan. He created a smartphone app that transmitted signals to Sandman's brain to force him to transform into different shapes. We apologize for the word salad, but comics are very strange.
If you download the real-life Marvel companion app, they'll send you an explanation for this bullshit.