Java tutorial
//package com.java2s; /** * * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. * */ import android.media.AudioFormat; public class Main { public static int getInFormat(int inChannels) { switch (inChannels) { case 1: return AudioFormat.CHANNEL_IN_MONO; case 2: return AudioFormat.CHANNEL_IN_STEREO; default: throw new IllegalArgumentException("illegal number of input channels: " + inChannels); } } }