NEW YORK -- A 17-year-old with a grudge against his former Long Island high school planned with his girlfriend to buy shotguns, enter his old school and indiscriminately shoot down students and teachers days before his ex-classmates were scheduled to graduate, police said Friday.

The two teenagers extensively researched bomb making, attempted to buy a shotgun and set a June 10 date for the planned attack on Connetquot High School in Bohemia, Suffolk County police Sgt. Bill Doherty said.

Evidence from the 16-year-old girl's computer and cell phone showed they'd searched bomb-making and explosives websites, and exchanged text messages in which they discussed plans to buy firearms and kill people, police said.

Both were arrested and charged as adults with conspiracy. The boy pleaded not guilty at his arraignment Friday, while his girlfriend entered a not-guilty plea last week. Each could face up to a year in jail if convicted.

Authorities uncovered the plan after the boy's social worker alerted them last month that the two might be planning an attack, Doherty said.

The warning followed what police believe was a public proclamation of the boy's venom for his former classmates. After a car accident that led to the death of two students earlier this year, someone using the 17-year-old's name left messages on a Facebook memorial page expressing his satisfaction.

"He apparently has quite a bit of hatred for this class in general," Doherty said.

Both teenagers tried to buy a shotgun but were turned away because neither was 18, so they hatched a plan to return on his June 8 birthday to buy one shotgun, then come back the following day for another. They planned to enter the school and start shooting on June 10, Doherty said.

The boy left Connetquot High School and graduated from a special-education program where he met the girl, who is still a student. She was released without bail; the boy will be held in jail until his court date June 8.