A judge has ordered three defendants charged with raping a female student at the University of Massachusetts to submit DNA samples to investigators.

Lawyers for all three men objected to the order Tuesday in Hampshire Superior Court, but immediately after the hearing 19-year Emmanuel Bile and 18-year-old Adam Liccardi, both of Pittsfield, and 18-year-old Caleb Womack, of Windsor Locks, Conn., submitted cheek-swab samples.

A fourth defendant in the case, 19-year-old Justin King, of Pittsfield, already had submitted a DNA sample.

All four are charged with raping the student in her Amherst dorm room in October. None of the suspects are UMass students, but all knew the woman.

They are free on bail after pleading not guilty. Their lawyers say the sex was consensual.