Finding the matrix mapping by considering non prime number as obstacle and prime number be valid path .
static void preprocessMatrix ( int [ , ] mappedMatrix , int [ , ] a , int n , int m ) { int [ ] prime = new int [ MAX ] ;