Reputation: 73
I'm working on a bluetooth application in eclipse and use an UUID to create a Rfcomm socket. However the UUID cause an error, claiming my UUID is an invalid long.
To create my UUID:
final UUID APP_ID = UUID.fromString("BEBCC5EO-0519-11E1-8AF7-EA9ECB6F1004");
....but that line gives this error:
java.lang.NumberFormatException: Invalid long: "BEBCC5EO"
Also tried this with the same result:
public String identifier = "BEBCC5EO-0519-11E1-8AF7-EA9ECB6F1004";
final UUID APP_ID = UUID.fromString(identifier);
Why does eclipse believe my string is a long? Please help me solve this error. Would be most greatful!
Upvotes: 1
Views: 1786
Reputation: 54672
UUID.fromString actually splits the input string at -
tokens. Then decode those a separated parts as Long
values.
In your case you used BEBCC5EO
. instead of BEBCC5E0
. Which can't be parsed as long
.
Upvotes: 0
Reputation: 9775
Letter O
in BEBCC5EO
is not a valid hexadecimal number. Hexa numbers are:
0 1 2 3 4 5 6 7 8 9 A B C D E F
Upvotes: 0
Reputation: 393811
"BEBCC5EO" should be "BEBCC5E0"
You had the letter "O" instead of the digit zero.
Upvotes: 4