I think the problem is with the constuction of the timestamp on the last line:
Look at the javadocs for this constructor:
Constructs a Timestamp object using a milliseconds time value. The integral seconds are stored in the underlying date value; the fractional seconds are stored in the nanos field of the Timestamp object.
Parameters:
time milliseconds since January 1, 1970, 00:00:00 GMT. A negative number is the number of milliseconds before January 1, 1970, 00:00:00 GMT.
The important bit here is
the number of milliseconds before January 1, 1970, 00:00:00 GMT
As you have specified a timezone of "Brazil/West", the value of cal.getTimeInMillis() is 1383105599000. If you change the timezone to "GMT", the value of cal.getTimeInMillis() is 1383177599000.
This explains why the output is not 2013-10-30 23:59:59.0