Array.12.

PHOTO EMBED

Sat Dec 10 2022 17:25:48 GMT+0000 (Coordinated Universal Time)

Saved by @KutasKozla #java

public class PJJJeden {

    public static void main(String[] args) {
        int[] tab = {25, 14, 56, 15, 36, 36, 77, 18, 29, 49};
        checkVal(tab);
    }
    public static boolean checkVal(int[] tab) {
        for (int i = 0; i < tab.length; i++) {
            if (tab[i] == tab[i + 1]) {
                System.out.println(tab[i]);
                return true;
            }
        }
        return false;
    }

}
content_copyCOPY

Find the duplicate values of an array of integer values

https://www.w3resource.com/java-exercises/array/java-array-exercise-12.php