This seems a bit strange to me. I created a static Integer array and then I am trying to assign a value to it. But I get a Null pointer exception at the degree[i] = 0 line.
Since I am not reading the value before assigning it, I do not understand why the NullPointer exception.
private static Integer[] degree;
public static void initDegree(int num_of_vertices) throws Exception{
for (int i = 0; i < num_of_vertices; i++) {
degree[i] = 0;
}
}