Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.net.TrafficStats;

public class Main {
    public static String getAllTraffic() {
        long traffic = TrafficStats.getTotalRxBytes();
        return byteToM(traffic) + "M";
    }

    public static long byteToM(long mByte) {
        return mByte / 1024 / 1024;
    }
}