Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static int getSSIDLength(String ssid) {
        int count = 0;
        char[] chars = ssid.toCharArray();
        for (char c : chars) {
            if (isChinese(c)) {
                count += 3;
            } else {
                count++;
            }
        }
        return count;
    }

    private static boolean isChinese(char c) {
        if ((c >= 0x4e00) && (c <= 0x9fbb)) {
            return true;
        }
        return false;
    }
}