import java.util.Scanner; public class Q2 { public static boolean twoLengthRun(float[] sequence) { if (sequence == null) return false; for (int i = 0; i < sequence.length - 1; i++) if (sequence[i] == sequence[i + 1]) return true; return false; } public static void main(String[] args) { String strNumbers; float[] numberArray; Scanner in = new Scanner(System.in); System.out.println("Please input a list of numbers separated by spaces:"); strNumbers = in.nextLine(); if (strNumbers.trim().isEmpty()) { System.out.println("The sequence is empty!"); return; } String[] strNumberArray = strNumbers.split("\\s+"); numberArray = new float[strNumberArray.length]; for (int i = 0; i < strNumberArray.length; i++) numberArray[i] = Float.parseFloat(strNumberArray[i]); System.out.println("Result: " + twoLengthRun(numberArray)); } }