Here you can find the source of degreesToRA(double val)
public static String degreesToRA(double val)
//package com.java2s; //License from project: Open Source License import java.text.NumberFormat; public class Main { private static NumberFormat raFormat = NumberFormat.getInstance(); public static String degreesToRA(double val) { // raneg reduction to [0.0,360.0) while (val < 0.0) { val += 360.0; }//from w w w.ja va 2 s. c om while (val >= 360.0) { val -= 360.0; } // 24 hours/360 degrees = 15 deg/hour int h = (int) (val / 15.0); val -= h * 15.0; // 15 deg/hour == 0.25 deg/min == 4 min/deg int m = (int) (val * 4.0); val -= m / 4.0; // 4 min/deg == 240 sec/deg val *= 240.0; String hh = Integer.toString(h); String mm = Integer.toString(m); if (h < 10) { hh = "0" + h; } if (m < 10) { mm = "0" + m; } return (hh + ":" + mm + ":") + raFormat.format(val); } }