Basic usage of array in matrix operations in JAVA