N.Y. CPL. LAW § 140.50 : NY Code - Section 140.50: Temporary questioning of persons in public places; search for weapons

1. In addition to the authority provided by this article for making an
  arrest without a warrant, a police officer may stop a person in a public
  place located within the geographical area of such officer's  employment
  when  he  reasonably  suspects  that  such  person  is  committing,  has
  committed or is about to commit either (a) a felony or (b) a misdemeanor
  defined in the penal law, and may demand of him his name, address and an
  explanation of his conduct.
    2. Any person who  is  a  peace  officer  and  who  provides  security
  services  for any court of the unified court system may stop a person in
  or about the courthouse to which  he  is  assigned  when  he  reasonably
  suspects  that  such  person is committing, has committed or is about to
  commit either (a) a felony or (b) a misdemeanor  defined  in  the  penal
  law,  and  may demand of him his name, address and an explanation of his
  conduct.
    3. When upon stopping  a  person  under  circumstances  prescribed  in
  subdivisions  one and two a police officer or court officer, as the case
  may be, reasonably suspects that he is in danger of physical injury,  he
  may search such person for a deadly weapon or any instrument, article or
  substance  readily  capable  of causing serious physical injury and of a
  sort not ordinarily carried in public places by law-abiding persons.  If
  he  finds  such a weapon or instrument, or any other property possession
  of which he reasonably believes  may  constitute  the  commission  of  a
  crime,  he  may  take  it  and  keep  it  until  the  completion  of the
  questioning, at which time  he  shall  either  return  it,  if  lawfully
  possessed, or arrest such person.