java – Program to validate if the matrix is ​​rotated

The program works as planned until it reaches the end. The program is still waiting for the user's input. I'm not completely sure how to fix it. You may have to use system.in.read ()? Anyway, if there is any advice on my code that I can give, it would be very appreciated.

/ * ================================================================================================== ================================================
Description:
This program will ask the user for two matrices. The isRotated function
check if the lengths are the same size for the elements. Going to
Then check if the matrix has been rotated by checking the elements of the
original from the first element to the last, while the other matrix will be
Checked from the last element to the first.

For example:

1st array = [1,2,3]
2nd matrix = [3,2,1]

output: the matrix is ​​rotated
==================================================================================================== ================================
Isarrayrotated package;

import java.util.Arrays;
import java.util.Scanner;

public class IsArrayRotated
{
Empty main static public (String[] args)
{
In t[] firstArray = new int[5];
In t[] secondArray = new int[5];
int int final arrayCap = 5;
Boolean rotation;
char again = & # 39; Y & # 39 ;;

Scanner scanned = new scanner (System.in);

System.out.println ("This program takes two matrices, compares them, and"
+ "determines if the original matrix has been rotated and placed"
+ "in another matrix.  nTry the program by entering 5 numbers in one"
+ "array.");
while ((again == & # 39; Y & # 39;) || (again == & # 39; and & # 39;))
{

// user enters integers in the first matrix
for (int i = 0; i <arrayCap; i ++)
FirstArray[i] = scan.nextInt ();

System.out.println (Arrays.toString (firstArray) + "is your array. If you  n"
+ "I would like the program to confirm that the matrix is ​​rotated"
+ "then simply write the first matrix you entered but in  n"
+ "reverse order, if not, write a different matrix.");

// the user enters integers in the second matrix
for (int i = 0; i <arrayCap; i ++)
secondArray[i] = scan.nextInt ();

// isRotated will compare if the matrix is ​​rotated
rotation = isRotated (firstArray, secondArray);

yes (rotation == true)
{
System.out.println ("The matrix is ​​rotated");
}plus{
System.out.println ("The matrix is ​​not rotated!");
}

// check if the user wants to repeat
System.out.println ("Try again? (Y / N)");
again = scan.next ("."). charAt (0);
}
}

public static boolean isRotated (int[] original, int[] tempArray)
{
boolean isRotated = true;
int inc = 1;

while ((original.length == tempArray.length) && (isRotated == true))
{
// loop to find all the elements of the original
for (int i = 0; i <original.length; i ++)
{
// compare the element in the original matrix to the element in tempArray
yes (original)[i] ! = tempArray[tempArray.length - inc])
{
isRotated = false;
}
inc ++;
}
break;
}
the return isRotated;
}
}