Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Bitmap;

public class Main {
    public static Bitmap scale(Bitmap bitmap, float scale) {
        if (bitmap == null) {
            return null;
        }
        int width = Math.max(1, (int) (bitmap.getWidth() * scale));
        int height = Math.max(1, (int) (bitmap.getHeight() * scale));
        return Bitmap.createScaledBitmap(bitmap, width, height, false);
    }
}