is there a public algorithm that formats German phone numbers (mobile and landlines)? I saw there is a method to format phone numbers PhoneNumberUtils.getFormatTypeForLocale(Locale locale)
but this is only for NANP countries, see here.
Maybe libphonenumber can do what you want?