package com.ssadagu.utils;
import java.util.Calendar;
public class Utils {
// key : res/values/array.xml .
public static final String[] USER_ACTIVITY_KEY = {
" ( )"
," ( )"
," ( 1~2 )"
," ( 2~3 )"
," ( 4~5 )"
," ( 5~6 )"
," ( 6~7 )"
};
// value
public static final double[] USER_ACTIVITY_VALUE = {0.3,0.4,0.5,0.6,0.7,0.8,0.9};
//
public static double getActivity(String key){
double rs=0;
int i=0;
for(String s:USER_ACTIVITY_KEY){
if(s.equals(key)){
rs = USER_ACTIVITY_VALUE[i];
break;
}
i++;
}
return rs;
}
public static int getActivity(double value){
int i=0;
for(double d:USER_ACTIVITY_VALUE){
if(d==value){
break;
}
i++;
}
return i;
}
public static int getSysYear() { return Calendar.getInstance().get(Calendar.YEAR); }
public static int getSysMonth() { return Calendar.getInstance().get(Calendar.MONTH); }
public static int getSysDay() { return Calendar.getInstance().get(Calendar.DAY_OF_MONTH); }
public static String setXX(int i){
String s = String.valueOf(i);
if(i<10){
s = "0"+s;
}
return s;
}
}
|