LM317 is an adjustable voltage regulator which takes an input voltage of 3 - 40V DC ... Vout = 1.25x(1 + 1000/240) = 6.458V Similarly if you have a target output voltage then you can calculate the R2 ...