Java tutorial
//package com.java2s; //License from project: Apache License import android.bluetooth.BluetoothDevice; import java.lang.reflect.Method; public class Main { public static boolean setPin(BluetoothDevice device, String str) throws Exception { Method setPinMethod = device.getClass().getMethod("setPin", new Class[] { byte[].class }); return (Boolean) setPinMethod.invoke(device, new Object[] { str.getBytes() }); } }