public static void main(String[] args) {
        // Initialize notProcessedNodes with all nodes
        for (int i = 0; i < GRAPH_SIZE; i++) {
            if (NODE != i) {
                notProcessedNodes.add(i);
            }
        }

        // Initialize distances with very big values
        Arrays.fill(distances, Integer.MAX_VALUE / 2);

        // Initialize Distances
        for (int i = 0; i < GRAPH_SIZE; i++) {
            if (graph[NODE][i] > 0) {
                distances[i] = graph[NODE][i];
            } else {
                distances[i] = Integer.MAX_VALUE / 2;
            }
        }

        // ===== the algorithm =====
        while (!notProcessedNodes.isEmpty()) {
            // find closest node and remove it from the list
            int nextClosestNode = findClosestNode();
            notProcessedNodes.remove(new Integer(nextClosestNode));

            for (int i = 0; i < GRAPH_SIZE; i++) {
                if (graph[nextClosestNode][i] != 0 &&
                        distances[i] > distances[nextClosestNode] + graph[nextClosestNode][i]) {
                    distances[i] = distances[nextClosestNode] + graph[nextClosestNode][i];
                }
            }
            System.out.println(Arrays.toString(distances));
        }

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