Android examples for Network:Mac Address
get IP From Mac Address
//package com.java2s; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Main { private final static String P2P_INT = "p2p0"; public static String getIPFromMac(String MAC) { BufferedReader br = null; try {// w w w.j a v a 2 s. c om br = new BufferedReader(new FileReader("/proc/net/arp")); String line; while ((line = br.readLine()) != null) { String[] splitted = line.split(" +"); if (splitted != null && splitted.length >= 4) { String device = splitted[5]; if (device.matches(".*" + P2P_INT + ".*")) { String mac = splitted[3]; if (mac.matches(MAC)) { return splitted[0]; } } } } } catch (Exception e) { e.printStackTrace(); } finally { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } return null; } }