'Role of decrement operator in the following statement?

Going through a solution for a problem I'm trying to solve and I am not able to understand how the decrement operator works in the following statement.

if (--degree[j] == 0) bfs.add(j);


Solution 1:[1]

Write some simple code to confirm what you think

int arr[] = {1};
    
if (-- arr[0] == 0) {
    System.out.println("true");
}

// and again
if (-- arr[0] != 0) {
    System.out.println("true");
}

output

true
true

Solution 2:[2]

import java.util.Arrays;
import static java.lang.System.*;

public class Main {
    public static void main(String[] args) {
            boolean thrown = false;
            int[] arr = new int[]{1};

            --arr[0];
            out.println("true");

            if (-- arr[0] != 0) out.println("true");
    }
}

**Output **

true
true

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Scary Wombat
Solution 2 Samitha Athurupana