fm/fmapp2/src/com/caf/fmradio/PresetStation.java
public static String parsePI(int piCode)
   {
      String callSign = "";
      if ( (piCode >> 8) == 0xAF)
      {//CALL LETTERS THAT MAP TO PI CODES = _ _ 0 0.
         piCode = ((piCode & 0xFF) << 8);
      }
      /* Run the second exception
         NOTE: For 9 special cases 1000,2000,..,9000 a double mapping
         occurs utilizing exceptions 1 and 2:
         1000->A100->AFA1;2000->A200->AFA2; ... ;
         8000->A800->AFA8;9000->A900->AFA9
      */
      if ( (piCode >> 12) == 0xA)
      {//CALL LETTERS THAT MAP TO PI CODES = _ 0 _ _.
         piCode = ((piCode & 0xF00) << 4) + (piCode & 0xFF);
      }
      if ( (piCode >= 0x1000) && (piCode <= 0x994E))
      {
         String ShartChar;
         /* KAAA - KZZZ */
         if ( (piCode >= 0x1000) && (piCode <= 0x54A7))
         {
            piCode -= 0x1000;
            ShartChar = "K";
         } else
         { /* WAAA - WZZZ*/
            piCode -= 0x54A8;
            ShartChar = "W";
         }
         int CharDiv = piCode / 26;
         int CharPos = piCode - (CharDiv * 26);
         char c3 = (char)('A'+CharPos);

         piCode = CharDiv;
         CharDiv = piCode / 26;
         CharPos = piCode - (CharDiv * 26);
         char c2 = (char)('A'+CharPos);

         piCode = CharDiv;
         CharDiv = piCode / 26;
         CharPos = piCode - (CharDiv * 26);
         char c1 = (char)('A'+CharPos);
         callSign = ShartChar + c1+ c2+ c3;
      } else if ( (piCode >= 0x9950) && (piCode <= 0x9EFF))
      {//3-LETTER-ONLY CALL LETTERS
         callSign = get3LetterCallSign(piCode);
      } else
      {//NATIONALLY-LINKED RADIO STATIONS CARRYING DIFFERENT CALL LETTERS
         callSign = getOtherCallSign(piCode);
      }
      return callSign;
   }
/** Routine parses the PI Code from Integer to Call Sign String
    *  Example: 0x54A6 -> KZZY
    */
Routine parses the PI Code from Integer to Call Sign String
Example: 0x54A6 -> KZZY
Routine parses the PI Code from Integer to Call Sign String Example : 0x54A6 - > KZZY
public static String parsePI(int piCode)
   {
      String callSign = "";
      if ( (piCode >> 8) == 0xAF)
      {
         piCode = ((piCode & 0xFF) << 8);
      }
      /* Run the second exception
         NOTE: For 9 special cases 1000,2000,..,9000 a double mapping
         occurs utilizing exceptions 1 and 2:
         1000->A100->AFA1;2000->A200->AFA2; ... ;
         8000->A800->AFA8;9000->A900->AFA9
      */
      if ( (piCode >> 12) == 0xA)
      {
         piCode = ((piCode & 0xF00) << 4) + (piCode & 0xFF);
      }
      if ( (piCode >= 0x1000) && (piCode <= 0x994E))
      {
         String ShartChar;
         /* KAAA - KZZZ */
         if ( (piCode >= 0x1000) && (piCode <= 0x54A7))
         {
            piCode -= 0x1000;
            ShartChar = "K";
         } else
         { /* WAAA - WZZZ*/
            piCode -= 0x54A8;
            ShartChar = "W";
         }
         int CharDiv = piCode / 26;
         int CharPos = piCode - (CharDiv * 26);
         char c3 = (char)('A'+CharPos);
         piCode = CharDiv;
         CharDiv = piCode / 26;
         CharPos = piCode - (CharDiv * 26);
         char c2 = (char)('A'+CharPos);
         piCode = CharDiv;
         CharDiv = piCode / 26;
         CharPos = piCode - (CharDiv * 26);
         char c1 = (char)('A'+CharPos);
         callSign = ShartChar + c1+ c2+ c3;
      } else if ( (piCode >= 0x9950) && (piCode <= 0x9EFF))
      {
         callSign = get3LetterCallSign(piCode);
      } else
      {
         callSign = getOtherCallSign(piCode);
      }
      return callSign;
   }
public static String parsePI ( int piCode ) { String callSign = "" ; if ( ( piCode >> 8 ) == 0xAF ) { piCode = ( ( piCode & 0xFF ) << 8 ) ; } /* Run the second exception
         NOTE: For 9 special cases 1000,2000,..,9000 a double mapping
         occurs utilizing exceptions 1 and 2:
         1000->A100->AFA1;2000->A200->AFA2; ... ;
         8000->A800->AFA8;9000->A900->AFA9
      */ if ( ( piCode >> 12 ) == 0xA ) { piCode = ( ( piCode & 0xF00 ) << 4 ) + ( piCode & 0xFF ) ; } if ( ( piCode >= 0x1000 ) && ( piCode <= 0x994E ) ) { String ShartChar ; /* KAAA - KZZZ */ if ( ( piCode >= 0x1000 ) && ( piCode <= 0x54A7 ) ) { piCode -= 0x1000 ; ShartChar = "K" ; } else { /* WAAA - WZZZ*/ piCode -= 0x54A8 ; ShartChar = "W" ; } int CharDiv = piCode / 26 ; int CharPos = piCode - ( CharDiv * 26 ) ; char c3 = ( char ) ( 'A' + CharPos ) ; piCode = CharDiv ; CharDiv = piCode / 26 ; CharPos = piCode - ( CharDiv * 26 ) ; char c2 = ( char ) ( 'A' + CharPos ) ; piCode = CharDiv ; CharDiv = piCode / 26 ; CharPos = piCode - ( CharDiv * 26 ) ; char c1 = ( char ) ( 'A' + CharPos ) ; callSign = ShartChar + c1 + c2 + c3 ; } else if ( ( piCode >= 0x9950 ) && ( piCode <= 0x9EFF ) ) { callSign = get3LetterCallSign ( piCode ) ; } else { callSign = getOtherCallSign ( piCode ) ; } return callSign ; }
Routine parses the PI Code from Integer to Call Sign String
  Example: 0x54A6 -> KZZY
Routine parses the PI Code from Integer to Call Sign String Example : 0x54A6 - > KZZY
//CALL LETTERS THAT MAP TO PI CODES = _ _ 0 0. //CALL LETTERS THAT MAP TO PI CODES = _ 0 _ _. //3-LETTER-ONLY CALL LETTERS //NATIONALLY-LINKED RADIO STATIONS CARRYING DIFFERENT CALL LETTERS