How to retrieve CellID, MNC, MCC and LAC‎ from LOCATION info ?

/**
 * This class contains methods to decode MCC/MNC/LAC/CELLID from LOCI which is
 * encoded as per GSM 0408 Standard.
 *
 * MCC : Mobile Country Code
 * MNC : Mobile Network Code
 * LAC : Location Area  Code
 * Cell ID: Unique number used to identify a Base Transceiver Station within a LAC.
 *
 */

public class MccMncParser {
       
       
        public static void main(String[] args)
        {
               
                MccMncParser.getCellIdFromLoci("42F1019C479A90");
        }

        public static void getCellIdFromLoci(String loci) {

                try {
                        StringBuilder sBuilder = new StringBuilder();
                        String mcc = loci.substring(0, 4);
                        String mnc = loci.substring(4, 6);
                        String lac = loci.substring(6, 10);
                        String cellId = loci.substring(10);

                        sBuilder.append(convHexToMcc(mcc) + "/" + convHexToMnc(mnc) + "/"
                                        + convHexToDecimal(lac) + "/" + convHexToDecimal(cellId));

                        System.out.println("MCC/MNCc/LAC/CELLID -> " + sBuilder.toString());
                } catch (Exception e) {

                }

        }

        public static String convHexToMcc(String mccCode) {
                StringBuilder hexBuilder = new StringBuilder();

                hexBuilder.append(mccCode.charAt(1)).append(mccCode.charAt(0))
                                .append(mccCode.charAt(3));
                return hexBuilder.toString();
        }

        public static String convHexToMnc(String mncCode) {
                StringBuilder hexBuilder = new StringBuilder(mncCode);

                return hexBuilder.reverse().toString();
        }

        public static String convHexToDecimal(String hex) {

                Long decimal = 0L;
                try {
                        decimal = Long.parseLong(hex, 16);
                } catch (Exception e) {
                        return hex;
                }
                return Long.toString(decimal);
        }

}

Search