Java tutorial
//package com.java2s; //License from project: Apache License import android.os.Build; import android.text.TextUtils; public class Main { /** Returns the consumer friendly device name */ public static String getDeviceName() { final String manufacturer = Build.MANUFACTURER; final String model = Build.MODEL; if (model.startsWith(manufacturer)) { return capitalize(model); } if (manufacturer.equalsIgnoreCase("HTC")) { // make sure "HTC" is fully capitalized. return "HTC " + model; } return capitalize(manufacturer) + " " + model; } private static final String capitalize(String str) { if (TextUtils.isEmpty(str)) { return str; } final char[] arr = str.toCharArray(); boolean capitalizeNext = true; String phrase = ""; for (final char c : arr) { if (capitalizeNext && Character.isLetter(c)) { phrase += Character.toUpperCase(c); capitalizeNext = false; continue; } else if (Character.isWhitespace(c)) { capitalizeNext = true; } phrase += c; } return phrase; } }