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

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

Introduction

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

Prototype

Fraction ONE

To view the source code for org.apache.commons.math3.fraction Fraction ONE.

Click Source Link

Document

A fraction representing "1".

Usage

From source file:bayesGame.BayesGame.java

public static int getNewWidth(int width) {
    Fraction multiplier = Fraction.ONE;
    if (gameResolution.equals("1600x900")) {
        multiplier = new Fraction(1600, 1920);
    }//from www.  j  a  v a 2s.  c o  m
    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;
    if (gameResolution.equals("1600x900")) {
        multiplier = new Fraction(900, 1080);
    }//from w w  w.  ja va 2  s .com
    if (gameResolution.equals("1280x720")) {
        multiplier = new Fraction(720, 1080);
    }
    Fraction newValue = multiplier.multiply(height);
    return newValue.intValue();
}