Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    private static boolean validatePin(String pin) {
        if (pin.length() == 4 && isDigit(pin.charAt(0)) && isDigit(pin.charAt(1)) && isDigit(pin.charAt(2))
                && isDigit(pin.charAt(3))) {
            return true;
        } else {
            return false;
        }
    }

    private static boolean isDigit(Character c) {
        if (c >= '0' && c <= '9') {
            return true;
        } else {
            return false;
        }
    }
}