public static void main(String[] args) {

		String[] hexList;
		Scanner scanner = new Scanner(System.in);

		do {

			// Read input, until it has correct length (normally 8 bytes = 16 hex digits)
			do {
				// Read line
				System.out.println("Please enter " + numberOfRows + " hexadecimal bytes:");
				String line = scanner.nextLine();

				// Split line into array
				hexList = line.split("\\s+");

				// Too many or too few bytes entered -> message
				if (hexList.length != numberOfBytes) {
					System.out.println("You have to enter exactly " + numberOfBytes + " bytes!");
				}
			}
			while (hexList.length != numberOfBytes);

			// Convert each byte to binary, create the string representation and print it out
			// E.g. "FF" -> 255
			int hexToDecimal;

			// E.g. "11111111"
			String binary;

			for (int i = 0; i < hexList.length; i++) {
				try {
					hexToDecimal = Integer.parseInt(hexList[i], 16);
				}

				catch (NumberFormatException e) {
					System.out.println(hexList[i] + " is not in hexadecimal format, line " + (i + 1) + " could not be created!");
					continue;
				}

				binary = Integer.toBinaryString(hexToDecimal);

				// Add leading zeros (if lost during conversion)
				binary = String.format("%1$" + numberOfBytes + "s", binary).replace(' ', '0');

				// Replace Ones and Zeros with corresponding symbols
				binary = binary.replaceAll("1", outputSymbolOne).replaceAll("0", outputSymbolZero);

				System.out.println(binary);
			}

			System.out.println("\nTry again? (y/n):");
		}

		while (scanner.nextLine().equals("y"));

		// Input finished
		scanner.close();

		System.out.println("Program ended successfully!");
	}