Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.os.Environment;

import android.util.Log;

import java.io.File;

public class Main {
    final private static String TAG = "IOHelper";

    public static int fileSize(String dir, String fileName) {
        File sdLien = Environment.getExternalStorageDirectory();
        File inFile = new File(sdLien + File.separator + dir + File.separator + fileName);
        Log.d(TAG, "path of file : " + inFile);
        if (!inFile.exists()) {
            throw new RuntimeException("File doesn't exist");
        }
        return ((int) inFile.length());
    }
}