Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.BitmapFactory;

public class Main {
    public static int calcSampleSize(BitmapFactory.Options options, int targetWidth, int targetHeigth) {
        final int heightRatio = Math.round((float) options.outHeight / (float) targetHeigth);
        final int widthRatio = Math.round((float) options.outWidth / (float) targetWidth);
        int inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
        return inSampleSize;
    }
}