Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.HashMap;

import java.util.StringTokenizer;

public class Main {
    public static String getIdentifier(HashMap<String, ArrayList<String>> addresses) {
        String wifi_address = addresses.get("eth0").get(0); //for now we expect there to be only 1 address, the one OLSRd has assigned
        //need to extract the 3rd and 4th octet of the address
        StringTokenizer tokens = new StringTokenizer(wifi_address, ".");
        tokens.nextElement();
        tokens.nextElement();
        String identifier = tokens.nextToken() + "." + tokens.nextToken();
        return identifier;
    }
}