Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static String spliteMobile(String mobile) {
        StringBuffer buffer = new StringBuffer(mobile);
        char[] chars = buffer.reverse().toString().toCharArray();
        StringBuffer result = new StringBuffer();
        for (int i = chars.length - 1; i >= 0; i--) {
            if (i % 4 == 0) {
                result.append(chars[i]).append(" ");
            } else {
                result.append(chars[i]);
            }
        }
        return result.toString();
    }
}