array initial method and sort patterns