Java tutorial
//package com.java2s; import android.util.Log; public class Main { public static String FormatBarCode(String barCode) { if (barCode.length() == 13) { Log.i("msg", "barcodeLength==13"); char[] temp = barCode.toCharArray(); return temp[0] + " " + temp[1] + temp[2] + temp[3] + temp[4] + temp[5] + temp[6] + " " + temp[7] + temp[8] + temp[9] + temp[10] + temp[11] + temp[12]; } Log.i("msg", "barcodeLength!=13"); return barCode; } }