Some clarifications before i answer. when you say "its too heavy to stay up on its own" do you mean that the arm is too heavy for the motor, or the arm doesn't stay at an angle when the motor is not powered? also, why are you controlling two motors, and reading only one encoder? perhaps you should provide a better description of your arm.
that being said, i would use simple proportional control for this. (proportional control being the "P" in what is more commonly called PID control). what you have above is called "bang" control.
basically, you just set up a linear relationship between encoder readings and motor current. (actually the difference between encoder readings of where the arm is and where you want it to be). For example:
void set_arm_to_angle(int angle)
{
int P = 200;
int error = angle - MotorEncoder[rightMotor];
motor[rightMotor] = P * error
}
you should be able to find lots of info on proportional control on the web. but basically, if the arm is lower than where you want, positive current is applied to raise the arm. the farther away from your desired angle, the more current. if the arm is too high, current is reversed.
it can be a little tricky figuring out the right gain (P). too low, and the arm won't move, too high and the arm will oscillate. i wouldn't worry about the I and D terms. but adding some friction to the arm might help.
and if you want more info on more advanced robot arm topics, this page give a gentle overview: http://www.societyofrobots.com/robot_arm_tutorial.shtml