You don't need to know the real angle in this code.
The code should be:
int deltaX = bullet.endpos.x - bullet.startx; //this code is when I create a new bullet
int deltaY = bullet.endpos.y - bullet.starty;
double radius = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
double normalizedDeltaX = deltaX / radius;
double normalizedDeltaY = deltaY / radius;
speed = 5.0;
bullet.x -= /*maybe your error is here, and there should be += as you need to increment coordinates, not decrement*/ speed * normalizedDeltaX;
bullet.y -= /*the same thing here*/ speed * normalizedDeltaY;
Or if you would really you this angle later (what for?) in this case Math.atan2
is more appreciated, because you won't lose third and fourth quarters of the plane:
double direction = Math.atan2(deltaY, deltaX);