Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

public class Main {

    public static String getFileType(File file) {
        String fileName = file.getName();
        int typeIndex = fileName.lastIndexOf(".");
        if (typeIndex != -1) {
            return fileName.substring(typeIndex + 1).toLowerCase();
        } else {
            return "";
        }
    }
}