Bridge Transport - contest practice
Instead of resetting the massOnBridge, you can declare it inside the body of the for loop:

for (int i = 0; i &lt; totalCars; i++) {
    int massOnBridge = 0;
    ...


It is a good practice to keep a scope of a variable as narrow as possible. 
There are a lot of comments in your code that tell what the code does. Instead, you should try to write a self-documenting code. You can increase modularity and clarity of your code by using separate methods for separate tasks. For instance,

// gets the sum of the masses on the bridge
for (int j = 0; j &lt; carsOnBridge.size(); j++) {
     massOnBridge += carsOnBridge.get(j);
}


looks like a very good candidate for a separate method:

/**
  * Computes the sum of elements of {@code aList}.
  * @param aList A list of integers. Must not contain {@code null} elements.
  *              Must be non-{@code null}.
  * @return The sum of elements of the given list.
  */
private static int getSum(List&lt;Integer&gt; aList) {
    int sum = 0;
    for (int value : aList) {
         sum += value;
    }
    return sum;
 }


Having one long method(main in your case) that does everything is a bad practice.