Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static double getPreviewAspectRatio(int width, int height) {
        double ratio = 0.0f;
        if (Math.abs((double) width / height - 4.0 / 3.0) > Math.abs((double) width / height - 16.0 / 9.0)) {
            ratio = 16.0f / 9.0f;
        } else {
            ratio = 4.0f / 3.0f;
        }
        return ratio;
    }
}