Question: The Raspberry Pi 3 includes BLE support. I confirmed it works by 

sudo hcitool lescan

which returned the MAC and BLE 'complete local name' for neighboring advertisers.

How does one access this programmatically, in Java?

Answer: 
To use BLE on Raspberry Pi 3 you have to update bluez (the bluetooth core in Raspbian linux) then use the bluez D-Bus interface to interact with it.

I'm looking for writing my own java lib, but it's very difficult because there are few documentation about D-Bus in java and about bluez.

For bluez there are only the sample code in the last distribution.

For now i have write a simple script that update the bluez version to the latest:
<https://gist.github.com/tongo/94338cebf4e6367d353439bca8d0a376>

I have also found a blog post that talk about d-bus,java and bluez:
<http://smartspacestuff.blogspot.it/2016/02/i-got-figurin-out-dbus-bluez.html>

It was useful, but not very clear for me.

I hope this can help.

If you found other documentation post it.
You can make this very simple by simply executing a command through Runtime and reading the output with a BufferedReader.

Executing the command:

```
Process p;
p = Runtime.getRuntime().exec(command);
p.waitFor();

```

Full code:

```
 package your.package.rpicommand;

 import java.io.BufferedReader;
 import java.io.InputStreamReader;

 public class ExecuteShellCommand {

public static void main(String[] args) {

    ExecuteShellCommand obj = new ExecuteShellCommand();

    String domainName = "google.com";

    //in mac oxs
    String command = "ping -c 3 " + domainName;

    //in windows
    //String command = "ping -n 3 " + domainName;

    String output = obj.executeCommand(command);

    System.out.println(output);

}

private String executeCommand(String command) {

    StringBuffer output = new StringBuffer();

    Process p;
    try {
        p = Runtime.getRuntime().exec(command);
        p.waitFor();
        BufferedReader reader =
                        new BufferedReader(new InputStreamReader(p.getInputStream()));

                    String line = "";
        while ((line = reader.readLine())!= null) {
            output.append(line + "\n");
        }

    } catch (Exception e) {
        e.printStackTrace();
    }

    return output.toString();

}

}

```

I wish I could of coded this for you but there is already plenty of example on the internet about this.

Although this is one way of doing this, you *should* use BlueCove or some library to scan through the Bluetooth devices.

Source: <https://www.mkyong.com/java/how-to-execute-shell-command-from-java/>