A University of Illinois student found himself in full panic mode after realizing he had forgot to wear a pair of pants to class.

Let us explain: On a particularly warm spring day, 19-year-old chemistry major Jake Wolf decided to take advantage of the nice weather by rocking a pair of shorts to class. The sartorial choice would've been completely fine for most other students; however, Wolf eventually remembered that shorts were prohibited inside the lab. So, he knew he had to change ... fast. 

"I show up to my lab, it’s 7:58, two minutes before my lab starts and I realize I'm in shorts, which is not good," he told BuzzFeed News

The website reports that the students were required to check into the lab by 8:10 a.m., giving Wolf only 12 minutes to change. But there was another big problem: The student's dorm was a 15-minute walk away. 

"I panicked," Wolf recalled. "I was like, how am I going to do this? If you miss a lab you’re basically guaranteed to drop a letter grade."

He refused to accept to defeat. As he started to run toward back to his dorm, Wolf spotted another student who was wearing a pair of sweats. Wolf took a chance.

"I’m by the business school and I see this one guy about to walk into the school and he’s wearing sweatpants," Wolf explained. "I said, 'Dude, I need your pants.'"

The stranger was University of Illinois student Sam Brown.

"At the time I was just kind of shocked," Brown told BuzzFeed. "And he explained again how he needed this because it would affect his grade. Then I felt like I should probably help this guy out."

They then headed to the restroom to make the switch. Wolf quickly took Brown's phone number so he could return the pants after he got out of the lab. As you can seen in the screenshots below, Wolf was in such a hurry, he listed Brown's contact under "Pants."

Wolf explained the incident via text to his good friend Chris Royer, who then decided to share the story on Twitter. The post has since garnered more than 22,000 retweets and over 144,000 likes. 

"I know if a stranger came up to me and asked me to switch pants, I’d say no," Wolf said. "I can’t believe he did that for me."