Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static long sizeFromMToLong(String sizeString) {
        long size = 0;
        if (sizeString.endsWith("M")) {
            sizeString = sizeString.substring(0, sizeString.length() - 1);
            size = (long) ((Double.valueOf(sizeString)) * 1024 * 1024);
        } else if (sizeString.endsWith("K")) {
            sizeString = sizeString.substring(0, sizeString.length() - 1);
            size = (long) ((Double.valueOf(sizeString)) * 1024);
        }
        return size;
    }
}