Java tutorial
//package com.java2s; import android.widget.TextView; public class Main { public static void setFormatedKey(String fingerprint, TextView field1, TextView field2) { int half = fingerprint.length() / 2; field1.setText(fingerprint.substring(0, half).replaceAll("(....)", "$1 ")); field2.setText(fingerprint.substring(half).replaceAll("(....)", "$1 ")); } }