You can use regex replacement, by searching for the numbers, then parsing and reformatting them.
In Java 9+, do it like this:
String input = "1081+34-3954";
DecimalFormat fmt = new DecimalFormat("#,##0", DecimalFormatSymbols.getInstance(Locale.US));
String result = Pattern.compile("\\d+{4,}").matcher(input)
.replaceAll(n -> fmt.format(Long.parseLong(n.group())));
System.out.println(result); // prints: 1,081+34-3,954
Any text that is not a 4+ digit number is left untouched.
In older Java versions, use a replacement loop:
String input = "1081+34-3954";
DecimalFormat fmt = new DecimalFormat("#,##0", DecimalFormatSymbols.getInstance(Locale.US));
StringBuffer buf = new StringBuffer();
Matcher m = Pattern.compile("\\d+{4,}").matcher(input);
while (m.find())
m.appendReplacement(buf, fmt.format(Long.parseLong(m.group())));
String result = m.appendTail(buf).toString();
System.out.println(result); // prints: 1,081+34-3,954