java program to find trace of a matrix