Example usage for org.apache.commons.math3.fraction BigFraction getNumeratorAsLong

List of usage examples for org.apache.commons.math3.fraction BigFraction getNumeratorAsLong

Introduction

In this page you can find the example usage for org.apache.commons.math3.fraction BigFraction getNumeratorAsLong.

Prototype

public long getNumeratorAsLong() 

Source Link

Document

Access the numerator as a long.

Usage

From source file:com.netflix.imfutility.util.ConversionHelper.java

/**
 * Converts the edit rate as a fraction instance to the edit rate form such as "50 1".
 *
 * @param editRate input//from w  w  w.j a  va 2 s . c o  m
 * @return output in a form "50 1"
 */
public static String toEditRate(BigFraction editRate) {
    return String.format("%s %s", String.valueOf(editRate.getNumeratorAsLong()),
            String.valueOf(editRate.getDenominatorAsLong()));
}

From source file:com.netflix.imfutility.util.ConversionHelper.java

/**
 * Converts the edit rate as a fraction instance to the edit rate form such as "50/1".
 *
 * @param editRate input/*from www  .  j av  a  2s  .  c  o  m*/
 * @return output in a form "50/1"
 */
public static String toREditRate(BigFraction editRate) {
    return String.format("%s/%s", String.valueOf(editRate.getNumeratorAsLong()),
            String.valueOf(editRate.getDenominatorAsLong()));
}