Analysis of finite temperature phase transition using level spacing