Java Utililty Methods Degree Convert to

List of utility methods to do Degree Convert to

Description

The list of methods to do Degree Convert to are organized into topic(s).

Method

Stringdeg2dms(double deg)
Function deg2dms calculates notation in hms from degrees
String hms = "";
int d = (int) deg;
int m = (int) ((deg - d) * 60);
double s = (deg - d - (m / 60.)) * 3600.;
if (m < 0)
    m *= -1;
if (s < 0)
    s *= -1;
...
doubledegrees(double d)
degrees
return d * (180 / Math.PI);
doubledegrees2Dist(double degrees, double radius)
Converts degrees (1/360th of circumference of a circle) into a distance as measured by the units of the radius.
return radians2Dist(toRadians(degrees), radius);
doubledegreesDiff(double a1, double a2)
diff align difference between 2 angles ]-180, 180]
double diff = a1 - a2;
while (diff > 180) {
    diff -= 360;
while (diff <= -180) {
    diff += 360;
return diff;
...
doubledegreeSin(double angle)
Computes sines of an angle in degrees.
if (angle == 0) {
    return 0;
if (angle == 90) {
    return 1;
if (angle == 180) {
    return 0;
...
doubledegreesMinSecToDegrees(String position)
degrees Min Sec To Degrees
double result;
try {
    if (position.charAt(position.length() - 1) == 'W' || position.charAt(position.length() - 1) == 'E') {
        result = Double.parseDouble(position.substring(7, 12)) / 60;
        result = (Double.parseDouble(position.substring(4, 6)) + result) / 60;
        result += Double.parseDouble(position.substring(0, 3));
    } else {
        result = Double.parseDouble(position.substring(6, 11)) / 60;
...
doubledegreesToDecimal(String input)
degrees To Decimal
char direction = input.charAt(0);
int degrees;
int minutes;
int seconds;
if (direction == 'E' || direction == 'W') {
    degrees = Integer.parseInt(input.substring(1, 4));
    minutes = Integer.parseInt(input.substring(4, 6));
    seconds = Integer.parseInt(input.substring(6));
...
doubledegreesToMetres(double degrees)
degrees To Metres
return degrees * 111139;
floatdegreesToPercent(float n)
degrees To Percent
return (Math.abs(n / 360f));
StringdegreesToRA(double val)
degrees To RA
while (val < 0.0) {
    val += 360.0;
while (val >= 360.0) {
    val -= 360.0;
int h = (int) (val / 15.0);
val -= h * 15.0;
...