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 

import android.os.Build;

public class Main {
    public static String getDeviceName() {
        String manufacturer = Build.MANUFACTURER;
        String model = Build.MODEL;

        if (model.startsWith(manufacturer))
            return (capitial(model));
        else
            return capitial(manufacturer) + "" + model;
    }

    public static String capitial(String str) {
        if (str == "" || str.length() == 0)
            return "";
        char first = str.charAt(0);
        if (Character.isUpperCase(first))
            return str;
        else
            return Character.toUpperCase(first) + str.substring(1);
    }
}