Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int getWinsFromString(String wins) {
        if (wins == null)
            return 0;
        else if (wins.length() == 0)
            return 0;
        else if (wins.equalsIgnoreCase("w"))
            return 1;
        else if (wins.equalsIgnoreCase("-"))
            return 0;
        else if (wins.equalsIgnoreCase("q"))
            return 1;
        else
            try {
                return Integer.parseInt(wins);
            } catch (NumberFormatException e) {
                return 0;
            }
    }
}