public static String dump(final DeviceDescriptor descriptor,final String manufacturer,final String product,final String serial){
  return String.format("Device Descriptor:%n" + "  bLength %18d%n" + "  bDescriptorType %10d%n"+ "  bcdUSB %19s%n"+ "  bDeviceClass %13d %s%n"+ "  bDeviceSubClass %10d%n"+ "  bDeviceProtocol %10d%n"+ "  bMaxPacketSize0 %10d%n"+ "  idVendor %17s%n"+ "  idProduct %16s%n"+ "  bcdDevice %16s%n"+ "  iManufacturer %12d%s%n"+ "  iProduct %17d%s%n"+ "  iSerial %18d%s%n"+ "  bNumConfigurations %7d%n",descriptor.bLength(),descriptor.bDescriptorType(),decodeBCD(descriptor.bcdUSB()),descriptor.bDeviceClass() & 0xff,getUSBClassName(descriptor.bDeviceClass()),descriptor.bDeviceSubClass() & 0xff,descriptor.bDeviceProtocol() & 0xff,descriptor.bMaxPacketSize0() & 0xff,String.format("0x%04x",descriptor.idVendor() & 0xffff),String.format("0x%04x",descriptor.idProduct() & 0xffff),decodeBCD(descriptor.bcdDevice()),descriptor.iManufacturer() & 0xff,(manufacturer == null) ? "" : (" " + manufacturer),descriptor.iProduct() & 0xff,(product == null) ? "" : (" " + product),descriptor.iSerialNumber() & 0xff,(serial == null) ? "" : (" " + serial),descriptor.bNumConfigurations() & 0xff);
}

public static String dump ( final DeviceDescriptor descriptor , final String manufacturer , final String product , final String serial ) { return String . format ( "Device Descriptor:%n" + "  bLength %18d%n" + "  bDescriptorType %10d%n" + "  bcdUSB %19s%n" + "  bDeviceClass %13d %s%n" + "  bDeviceSubClass %10d%n" + "  bDeviceProtocol %10d%n" + "  bMaxPacketSize0 %10d%n" + "  idVendor %17s%n" + "  idProduct %16s%n" + "  bcdDevice %16s%n" + "  iManufacturer %12d%s%n" + "  iProduct %17d%s%n" + "  iSerial %18d%s%n" + "  bNumConfigurations %7d%n" , descriptor . bLength ( ) , descriptor . bDescriptorType ( ) , decodeBCD ( descriptor . bcdUSB ( ) ) , descriptor . bDeviceClass ( ) & 0xff , getUSBClassName ( descriptor . bDeviceClass ( ) ) , descriptor . bDeviceSubClass ( ) & 0xff , descriptor . bDeviceProtocol ( ) & 0xff , descriptor . bMaxPacketSize0 ( ) & 0xff , String . format ( "0x%04x" , descriptor . idVendor ( ) & 0xffff ) , String . format ( "0x%04x" , descriptor . idProduct ( ) & 0xffff ) , decodeBCD ( descriptor . bcdDevice ( ) ) , descriptor . iManufacturer ( ) & 0xff , ( manufacturer == null ) ? "" : ( " " + manufacturer ) , descriptor . iProduct ( ) & 0xff , ( product == null ) ? "" : ( " " + product ) , descriptor . iSerialNumber ( ) & 0xff , ( serial == null ) ? "" : ( " " + serial ) , descriptor . bNumConfigurations ( ) & 0xff ) ; }
dumps the specified usb device descriptor into a string and returns it .
