The purpose of this article is to assure that all persons, regardless of their financial status, shall not needlessly be detained pending their appearance to answer charges or to testify, or pending appeal, when detention serves neither the ends of justice nor the public interest.
K.S.A. 22-2801