How to convert Litcoin address from L to M and 3 to M in JAVA

data in my database is being saved in M prefix so i need to convert addresses before save.
Is there anyway to convert that in JAVA?