Example usage for org.apache.commons.math3.fraction Fraction intValue

List of usage examples for org.apache.commons.math3.fraction Fraction intValue

Introduction

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

Prototype

@Override
public int intValue() 

Source Link

Document

Gets the fraction as an int.

Usage

From source file:bayesGame.BayesGame.java

public static int getNewWidth(int width) {
    Fraction multiplier = Fraction.ONE;/*from   ww  w . j  a v  a 2  s  . c o m*/
    if (gameResolution.equals("1600x900")) {
        multiplier = new Fraction(1600, 1920);
    }
    if (gameResolution.equals("1280x720")) {
        multiplier = new Fraction(1280, 1920);
    }
    Fraction newValue = multiplier.multiply(width);
    return newValue.intValue();
}

From source file:bayesGame.BayesGame.java

public static int getNewHeight(int height) {
    Fraction multiplier = Fraction.ONE;/*from  w ww  .j ava 2 s .co m*/
    if (gameResolution.equals("1600x900")) {
        multiplier = new Fraction(900, 1080);
    }
    if (gameResolution.equals("1280x720")) {
        multiplier = new Fraction(720, 1080);
    }
    Fraction newValue = multiplier.multiply(height);
    return newValue.intValue();
}