Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Remove zero characters from string value passed to method
     * @param s = string value to remove zeros from
     * @return s with zero's removed
     */
    public static String removeZeros(String s) {

        String r = "";
        char zero = '0';

        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) != zero)
                r += s.charAt(i);
        }

        return r;
    }
}