How to multiply a matrix already created with random numbers to itself ?
Hello everyone. I created a matrix with random integers and I have to multiply this matrix to itself and print it. And I have to do the multiplication in an another method. Here is my code : public class Deneme21 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int [][]a = new int [10][10]; gunesF(a); } /** * * @param sayi * @return */ public static boolean isPrime(int sayi){ boolean sonuc = true; for (int i = 2; i < sayi; i++){ if (sayi % i == 0){ sonuc = false; break; } } return sonuc; } public static void gunesF(int [][] a) { Random randomNum = new Random(); for (int x = 0; x < 10; x++){ for (int y = 0; y < 10; y++){ int s; s = randomNum.nextInt(100); a[x][y] = s; } } for (int x = 0; x < 10; x++){ for (int y = 0; y < 10; y++){ if (isPrime(a[x][y])){ System.out.print(a[x][y] + "* "); } else { System.out.print(a[x][y] + " "); } } System.out.println(" "); } } }