Binary large law optimal threshold algorithm