I'm unable to get UUID of a iBeacon on pre-Lollipop devices, but below my code is working in Marshmallow Nexus 5x.
I dont want to use any library like AltBeacon or related.
BluetoothManager bm = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
BluetoothAdapter mBluetoothAdapter = bm.getAdapter();
if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
    //Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
    //startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
} else {
    BluetoothLeScanner scanner = mBluetoothAdapter.getBluetoothLeScanner();
    // scan for devices
    scanner.startScan(new ScanCallback() {
        @Override
        public void onScanResult(int callbackType, ScanResult result) {
            // get the discovered device as you wish
            // this will trigger each time a new device is found
            BluetoothDevice device = result.getDevice();
            if (device.getType() == BluetoothDevice.DEVICE_TYPE_LE) { //int the device type DEVICE_TYPE_CLASSIC, DEVICE_TYPE_LE DEVICE_TYPE_DUAL. DEVICE_TYPE_UNKNOWN if it's not available
                if (device.fetchUuidsWithSdp()) {
                    System.out.println(device.getName());
                    List<ParcelUuid> uuids = result.getScanRecord().getServiceUuids();
                    System.out.println(uuids);
                    System.out.println(getMajor(result.getScanRecord().getBytes()));
                    System.out.println(getMinor(result.getScanRecord().getBytes()));
                } else {
                    System.out.println("failed");
                }
            }
        }
    });
}