Example usage for android.util Rational getDenominator

List of usage examples for android.util Rational getDenominator

Introduction

In this page you can find the example usage for android.util Rational getDenominator.

Prototype

public int getDenominator() 

Source Link

Document

Gets the denominator of the rational

The denominator may return 0 , in which case the rational may represent positive infinity (if the numerator was positive), negative infinity (if the numerator was negative), or NaN (if the numerator was 0 ).

The denominator will always return 1 if the numerator is 0 .

Usage

From source file:com.android.camera2.its.ItsSerializer.java

@SuppressWarnings("unchecked")
private static Object serializeRational(Rational rat) throws org.json.JSONException {
    JSONObject ratObj = new JSONObject();
    ratObj.put("numerator", rat.getNumerator());
    ratObj.put("denominator", rat.getDenominator());
    return ratObj;
}

From source file:com.android.camera2.its.ItsService.java

private static float r2f(Rational r) {
    return (float) r.getNumerator() / (float) r.getDenominator();
}