Java tutorial
//package com.java2s; import java.io.File; import java.io.IOException; public class Main { /** * @param i slot index * @return valid directory of BMI device root * @throws IOException */ private static File getBMIDeviceRoot(int i) throws IOException { File root = new File("/sys/devices/platform/omap_bmi_slot.$i/bmi/bmi-$i/bmi-dev-$i/".replace("$i", "" + i)); if (!root.exists() || root.isFile() || root.listFiles().length == 0) return null; return root; } }