So i have 2 different arrays that should be the same (?) that are just declared in different ways and are named differently:
public static int[][] box = new int[10][5];
public static int[][] testBox ={{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},
{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},
{0,0,0,0,0}};
Now i have the followming Method:
public static boolean putProductIntoBox(int[] product) {
    if ((getFreePositionToFit(product) != null) && (remainingWeight >= product[2])) {
        for (int i = getFreePositionToFit(product)[0];i-getFreePositionToFit(product)[0] < product[1]; i++) {
  67          for (int j = getFreePositionToFit(product)[1]; j-getFreePositionToFit(product)[1] < product[0]; j++) {
                   testBox/box[j][i] =  product[3]; // <- testBox works , box not
            }
        }
        remainingWeight -= product[2];
        return true;
    } else {
        return false;
    }
}
Now what really boggles me :
I go into the method with a product[0] being 10 (length of the product) and product[1] being 5 (width of the product).
Now look at line 4 of the method : If i run it with testBox[j][i] it works just fine
If it run the method with box[j][i] i get a NullPointerException in line 67
(The other methods in putProductIntoBox work fine , tested them)
Could someone tell me why that is and how i fix it ?
Thanks
 
    