@Test
public void formatTransactionAddress() {

    String address = "0x2e95e3ce0a54951eb9a99152a6d5827872dfb4fd";
    String text = null;
    if (address != null) {
        String regex = "(\\w{4})(\\w*)(\\w{4})";
        try {
            text = address.replaceAll(regex, "$1...$3");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    assertEquals("0x2e...b4fd", text);
}