The following issues were found

lectures/9-linear search/code/src/com/kunal/FindMin.java
3 issues
System.out.println is used
Design

Line: 6

              public class FindMin {
    public static void main(String[] args) {
        int[] arr = {18, 12, 7, 3, 14, 28};
        System.out.println(min(arr));
    }

    // assume arr.length != 0
    // return the minimum value in the array
    static int min(int[] arr) {

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 3

              package com.kunal;

public class FindMin {
    public static void main(String[] args) {
        int[] arr = {18, 12, 7, 3, 14, 28};
        System.out.println(min(arr));
    }

    // assume arr.length != 0

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 11

              
    // assume arr.length != 0
    // return the minimum value in the array
    static int min(int[] arr) {
        int ans = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] < ans) {
                ans = arr[i];
            }

            

Reported by PMD.

lectures/5-first-java-program/first-idea-program/src/com/kunal/Main.java
3 issues
System.out.println is used
Design

Line: 8

              public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println(input.nextLine());
    }
}

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 5

              
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println(input.nextLine());
    }
}

            

Reported by PMD.

Ensure that resources like this Scanner object are closed after use
Error

Line: 7

              
public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println(input.nextLine());
    }
}

            

Reported by PMD.

lectures/7-methods/code/src/com/kunal/ChangeValue.java
3 issues
System.out.println is used
Design

Line: 10

                      // create an array
        int[] arr = {1, 3, 2, 45, 6};
        change(arr);
        System.out.println(Arrays.toString(arr));
    }

    static void change(int[] nums) {
        nums[0] = 99; // if you make a change to the object via this ref variable, same object will be changed
    }

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 5

              
import java.util.Arrays;

public class ChangeValue{
    public static void main(String[] args) {
        // create an array
        int[] arr = {1, 3, 2, 45, 6};
        change(arr);
        System.out.println(Arrays.toString(arr));

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 13

                      System.out.println(Arrays.toString(arr));
    }

    static void change(int[] nums) {
        nums[0] = 99; // if you make a change to the object via this ref variable, same object will be changed
    }
}

            

Reported by PMD.

lectures/6-conditions-loops/code/src/com/kunal/Largest.java
3 issues
System.out.println is used
Design

Line: 35

              
        int max = Math.max(c, Math.max(a, b));

        System.out.println(max);
    }
}

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 5

              
import java.util.Scanner;

public class Largest {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int a = in.nextInt();
        int b = in.nextInt();

            

Reported by PMD.

Ensure that resources like this Scanner object are closed after use
Error

Line: 7

              
public class Largest {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();


            

Reported by PMD.

lectures/10-binary search/code/src/com/kunal/OrderAgnosticBS.java
3 issues
System.out.println is used
Design

Line: 9

                      int[] arr = {99, 80, 75, 22, 11, 10, 5, 2, -3};
        int target = 22;
        int ans = orderAgnosticBS(arr, target);
        System.out.println(ans);
    }

    static int orderAgnosticBS(int[] arr, int target) {
        int start = 0;
        int end = arr.length - 1;

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 3

              package com.kunal;

public class OrderAgnosticBS {
    public static void main(String[] args) {
//        int[] arr = {-18, -12, -4, 0, 2, 3, 4, 15, 16, 18, 22, 45, 89};
        int[] arr = {99, 80, 75, 22, 11, 10, 5, 2, -3};
        int target = 22;
        int ans = orderAgnosticBS(arr, target);
        System.out.println(ans);

            

Reported by PMD.

Found 'DU'-anomaly for variable 'isAsc' (lines '17'-'43').
Error

Line: 17

                      int end = arr.length - 1;

        // find whether the array is sorted in ascending or descending
        boolean isAsc = arr[start] < arr[end];

        while(start <= end) {
            // find the middle element
//            int mid = (start + end) / 2; // might be possible that (start + end) exceeds the range of int in java
            int mid = start + (end - start) / 2;

            

Reported by PMD.

lectures/10-binary search/code/src/com/kunal/FirstAndLastPosition.java
3 issues
Found 'DD'-anomaly for variable 'ans' (lines '10'-'12').
Error

Line: 10

              
    public int[] searchRange(int[] nums, int target) {

        int[] ans = {-1, -1};
        // check for first occurrence if target first
        ans[0] = search(nums, target, true);
        if (ans[0] != -1) {
            ans[1] = search(nums, target, false);
        }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'ans' (lines '21'-'35').
Error

Line: 21

              
    // this function just returns the index value of target
    int search(int[] nums, int target, boolean findStartIndex) {
        int ans = -1;
        int start = 0;
        int end = nums.length - 1;
        while(start <= end) {
            // find the middle element
//            int mid = (start + end) / 2; // might be possible that (start + end) exceeds the range of int in java

            

Reported by PMD.

Found 'DD'-anomaly for variable 'ans' (lines '35'-'35').
Error

Line: 35

                              start = mid + 1;
            } else {
                // potential ans found
                ans = mid;
                if (findStartIndex) {
                    end = mid - 1;
                } else {
                    start = mid + 1;
                }

            

Reported by PMD.

lectures/5-first-java-program/first-tutorial/Main.java
2 issues
System.out.println is used
Design

Line: 3

              public class Demo {
    public static void main(String[] args) {
        System.out.println(args[0]);
    }
}
            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 1

              public class Demo {
    public static void main(String[] args) {
        System.out.println(args[0]);
    }
}
            

Reported by PMD.

lectures/9-linear search/code/src/com/kunal/SearchInRange.java
2 issues
System.out.println is used
Design

Line: 7

                  public static void main(String[] args) {
        int[] arr = {18, 12, -7, 3, 14, 28};
        int target = 3456;
        System.out.println(linearSearch(arr, target, 1, 4));
    }

    static int linearSearch(int[] arr, int target, int start, int end) {
        if (arr.length == 0) {
            return -1;

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 3

              package com.kunal;

public class SearchInRange {
    public static void main(String[] args) {
        int[] arr = {18, 12, -7, 3, 14, 28};
        int target = 3456;
        System.out.println(linearSearch(arr, target, 1, 4));
    }


            

Reported by PMD.

lectures/6-conditions-loops/code/src/com/kunal/Reverse.java
2 issues
System.out.println is used
Design

Line: 16

                          ans = ans * 10 + rem;
        }

        System.out.println(ans);
    }
}

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 3

              package com.kunal;

public class Reverse {
    public static void main(String[] args) {
        int num = 123456;

        int ans = 0;

        while (num > 0) {

            

Reported by PMD.

lectures/10-binary search/code/src/com/kunal/BinarySearch.java
2 issues
System.out.println is used
Design

Line: 9

                      int[] arr = {-18, -12, -4, 0, 2, 3, 4, 15, 16, 18, 22, 45, 89};
        int target = 22;
        int ans = binarySearch(arr, target);
        System.out.println(ans);
    }

    // return the index
    // return -1 if it does not exist
    static int binarySearch(int[] arr, int target) {

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 3

              package com.kunal;

public class BinarySearch {

    public static void main(String[] args) {
        int[] arr = {-18, -12, -4, 0, 2, 3, 4, 15, 16, 18, 22, 45, 89};
        int target = 22;
        int ans = binarySearch(arr, target);
        System.out.println(ans);

            

Reported by PMD.