Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    /**
     * computes the log10 of all values of the passed array
     * @param _arr the array to compute log10 from
     * @return an array containing the log10 of the passed array
     */
    public static double[] log10(double[] _arr) {
        double[] res = new double[_arr.length];
        for (int i = 0; i < res.length; i++) {
            if (0.0 == _arr[i]) {
                res[i] = 0;
                continue;
            }
            //         Log.e("ArrayHelper", "before log:"+_arr[i]);
            res[i] = Math.log10(Math.abs(_arr[i]));
            //         Log.e("ArrayHelper", "after log:"+res[i]);
        }
        return res;
    }
}