Implementation in Java

 /**
    * Returns the amount in cents as formatted amount
    *
    * @param amount
    * @return
    */
   public static String getFormattedAmount(int amount) {
       int cents = amount % 100;
       int dollars = (amount - cents) / 100;

       String camount;
       if (cents <= 9) {
           camount = 0 + "" + cents;
       } else {
           camount = "" + cents;
       }

       return "$" + dollars + "." + cents;

   }

Implementation in Objective C

+(NSString*) formatAmount:(int) amount
{

    int cents = amount % 100;
    int dollars = (amount - cents) / 100;

    NSString *camount;
    if (cents <=9)
    {
        camount = [NSString stringWithFormat:@"0%d",cents];
    }
    else
    {
        camount = [NSString stringWithFormat:@"%d",cents];
    }
    NSString *t = [NSString stringWithFormat:@"$%d.%@",dollars,camount];

    return t;
}