AABB collision response / resolution

this is how I obtain the values

[java]
public float calculateXOffset(BoundingBox bb, float x)
{
Vector3f min = bb.getMin(null);
Vector3f max = bb.getMax(null);

if (this.maxY > min.y && this.minY  min.z && this.minZ  0 && this.maxX >= min.x)
		{
			offset = min.x - this.maxX;

			if (offset < x)
			{
				x = offset;
				return x;
			}
		}

		if (x < 0 && this.minX  x)
			{
				x = offset;
			}
		}
	}
}
return x;

}
[/java]

x is the original velocity vector from the blue box to the red box