Convert 18 Character Id to 15 Character in Salesforce Apex

String accountId = String.valueOf(acc.Id).substring(0, 15);