/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	
	private static final int MODE_SHIFT = 30;
    private static final int MODE_MASK  = 0x3 << MODE_SHIFT;
    public static final int UNSPECIFIED = 0 << MODE_SHIFT;
    public static final int EXACTLY     = 1 << MODE_SHIFT;
    public static final int AT_MOST     = 2 << MODE_SHIFT;
        
	public static void main (String[] args) throws java.lang.Exception
	{
		int measureSpec = 0x7fffffff;
		int measureSpec2 = 0x40000100;
		
		displayMeasureSpecInfos( measureSpec );
		displayMeasureSpecInfos( measureSpec2 );
		
	}
	
	private static void displayMeasureSpecInfos( int spec ) {
		System.out.println( Integer.toHexString(spec) );
		System.out.println("Spec is UNSPECIFIED "+ (getMode(spec) == UNSPECIFIED));
		System.out.println("Spec is EXACTLY "+ (getMode(spec) == EXACTLY));
		System.out.println("Spec is AT_MOST "+ (getMode(spec) == AT_MOST));
		System.out.println( "Measure is " + getSize(spec) );
		System.out.println( "-----" );
	}
	
	public static int getMode(int measureSpec) {
        return (measureSpec & MODE_MASK);
    }

    public static int getSize(int measureSpec) {
        return (measureSpec & ~MODE_MASK);
    }
}