Get the last two digits of a string
sb.insert(0, charArray[i]);
            if (sb.length() == 2)
                break;
        }
    }

    return sb.toString();



You could change this to 

             sb.append(charArray[i]);
             if (sb.length() &gt;= digitCount) {
                 break;
             }
         }
     }

     return sb.reverse().toString();


Then you're using your StringBuilder as intended.  Appending rather than constantly inserting.  

Changing 2 to digitCount allows you to alter the number of digits to find easily.  

I prefer to always use the block form of control structures, even when the statement form would work.