Example usage for java.lang Integer MAX_VALUE

List of usage examples for java.lang Integer MAX_VALUE

Introduction

In this page you can find the example usage for java.lang Integer MAX_VALUE.

Prototype

int MAX_VALUE

To view the source code for java.lang Integer MAX_VALUE.

Click Source Link

Document

A constant holding the maximum value an int can have, 231-1.

Usage

From source file:Main.java

public static boolean isServiceRunning(Context context, Class serviceClass) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    for (ActivityManager.RunningServiceInfo serviceInfo : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (serviceClass.getName().equals(serviceInfo.service.getClassName())) {
            return true;
        }/*from   w w  w .  jav a 2  s . c o m*/
    }
    return false;
}

From source file:Main.java

public static boolean isServiceRunning(Context context) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

    for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        Log.d("InformatonUtils", "Service Name = " + service.service.getClassName());
        if ("com.safecell.TrackingService".equals(service.service.getClassName())) {
            return true;
        }//w ww . ja v  a2s  . co m
    }
    return false;
}

From source file:Main.java

public static String getThreadHeadline(long threadID) {
    ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
    ThreadInfo threadInfo = threadMXBean.getThreadInfo(threadID, Integer.MAX_VALUE);
    return getThreadHeadline(threadInfo);
}

From source file:Main.java

public static int copy(InputStream input, OutputStream output) throws IOException {
    long count = copyLarge(input, output);
    if (count > Integer.MAX_VALUE) {
        return -1;
    }/* ww  w.j a  v a2  s.c o  m*/
    return (int) count;
}

From source file:Main.java

public static boolean isRun(Context context, Class<?> clazz) {
    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    List<ActivityManager.RunningServiceInfo> serviceList = activityManager
            .getRunningServices(Integer.MAX_VALUE);
    if (!(serviceList.size() > 0)) {
        return false;
    }/*  w  w  w . j av a  2 s.com*/
    for (int i = 0; i < serviceList.size(); i++) {
        if (serviceList.get(i).service.getClassName().equals(clazz.getName())) {
            return true;
        }
    }
    return false;
}

From source file:Main.java

public static int min(final int... values) {
    int min = Integer.MAX_VALUE;
    for (final int v : values) {
        min = Math.min(v, min);/*  w  ww. j a  va  2  s.  c om*/
    }
    return min;
}

From source file:Main.java

@SuppressWarnings("static-access")
public static boolean isServiceRunning(Context c, String serviceName) {
    ActivityManager manager = (ActivityManager) c.getSystemService(c.ACTIVITY_SERVICE);
    for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (serviceName.equals(service.service.getClassName())) {
            return true;
        }//from   w  ww. ja  va  2  s. c o m
    }
    return false;
}

From source file:Main.java

private static int getImageViewFieldValue(Object object, String fieldName) {
    int value = 0;
    try {//from w w  w .  ja va 2s  .  co  m
        Field field = ImageView.class.getDeclaredField(fieldName);
        field.setAccessible(true);
        int fieldValue = field.getInt(object);
        if (fieldValue > 0 && fieldValue < Integer.MAX_VALUE) {
            value = fieldValue;
        }
    } catch (Exception e) {
    }
    return value;

}

From source file:Main.java

private static int getImageViewFieldValue(Object object, String fieldName) {
    int value = 0;
    try {/*from w  w  w .java 2 s. c  o m*/
        Field field = ImageView.class.getDeclaredField(fieldName);
        field.setAccessible(true);
        int fieldValue = (Integer) field.get(object);
        if (fieldValue > 0 && fieldValue < Integer.MAX_VALUE) {
            value = fieldValue;
        }
    } catch (Exception e) {
    }
    return value;
}

From source file:Main.java

public static boolean isMyServiceRunning(Context context, String serviceClassName) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Activity.ACTIVITY_SERVICE);
    for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (serviceClassName.equalsIgnoreCase(service.service.getClassName())) {
            return true;
        }/*from  w w w  . j  av a  2 s  .co m*/
    }
    return false;
}