From de1a14864ec9e78acf6e2aba7404f21d23b00de8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Thu, 3 Mar 2022 15:25:00 +0100 Subject: [PATCH] lab11 --- bin/lab11_debugging/NumberAnalyzer.class | Bin 1695 -> 1695 bytes src/lab11_debugging/NumberAnalyzer.java | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/lab11_debugging/NumberAnalyzer.class b/bin/lab11_debugging/NumberAnalyzer.class index e69930be286c2d4764adb497c9dfe89d0b8f708d..ee3d3ab72b5091420a9d8b821657873fed01925b 100644 GIT binary patch delta 14 VcmbQwJD+z$Aq%7N<{}ndCIBN%1PTBE delta 14 VcmbQwJD+z$Aq!*5<{}ndCIBRJ1Umo# diff --git a/src/lab11_debugging/NumberAnalyzer.java b/src/lab11_debugging/NumberAnalyzer.java index 7105dfd..670433c 100644 --- a/src/lab11_debugging/NumberAnalyzer.java +++ b/src/lab11_debugging/NumberAnalyzer.java @@ -12,7 +12,7 @@ import java.util.Random; */ public class NumberAnalyzer { public static void main(String[] args) { - int[] array = createRandomArray(100, 100); + int[] array = createRandomArray(100, 51); displayArray(array); int position = firstRepeatedNumber(array); System.out.println("The first repeated element is at location " + position); @@ -27,7 +27,7 @@ public class NumberAnalyzer { */ public static int firstRepeatedNumber(int[] inputArray) { for (int i = 0; i < inputArray.length; i++) { - if (inputArray[i] == inputArray[i + 1]) + if (inputArray[i] == inputArray[i + 1]) // can't work, for should finish to lenght-1 return i; } return -1;