Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    private static final char UNIX_SEPARATOR = '/';
    private static final char WINDOWS_SEPARATOR = '\\';

    private static int indexOfLastSeparator(String filename) {
        if (filename == null) {
            return -1;
        } else {
            int lastUnixPos = filename.lastIndexOf(UNIX_SEPARATOR);
            int lastWindowsPos = filename.lastIndexOf(WINDOWS_SEPARATOR);
            return Math.max(lastUnixPos, lastWindowsPos);
        }
    }
}