Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.annotation.SuppressLint;
import android.graphics.Color;

public class Main {
    /**
     * converts int value to color
     *
     * @param value The integer value of service layer
     * @return The parsed color from input int
     */
    public static int getColorInt(int value) {
        return Color.parseColor("#" + doublePrecision(value) + "000000");
    }

    /**
     * coverts int to string with precision to two places
     *
     * @param time The input int
     * @return The string value
     */
    @SuppressLint("DefaultLocale")
    public static String doublePrecision(int time) {
        return String.format("%02d", time);
    }
}