This paper presents a new methodology for generating a straight legged walking pattern for a biped robot utilizing up-and-down motion of an upper body. Firstly, we define two new indexes, the Knee Stretch Index (KSI) and the Knee Torque Index (KTI), which indicate how efficiently the knee joints are utilized. Next, up-and-down motion of the upper body is automatically planned so that these indexes are optimized and straight legged walking is realized. The basic idea of the proposed method is, i) when a large number of DOFs of motion are required for controlling the ZMP, a robot makes its body height lower, ii) when there is a extra number of DOFs of motion, the body is lifted and the knee joint is stretched. By stretching the knee joints, human-like natural walking motion is obtained. Moreover, energy efficiency is improved since required torque and energy consumption to support the body weight become small at knee joints. The effectiveness of the proposed method is demonstrated by computer simulation and experiments using a humanoid robot, HOAP-1.