aspose file tools*
The moose likes Beginning Java and the fly likes  cannot convert from long to byte Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " cannot convert from long to byte" Watch " cannot convert from long to byte" New topic
Author

cannot convert from long to byte

Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

for some reason I get this error in this code, how can I fix it?



Jesus lives
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Are you familiar with casting?
Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

yes, I tried this and it worked, thanks
Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

however I get strange results


It prints out "-77 -77 -77 -77" I can figure out why I get the same numbers
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14347
    
  22

Hint: The >> operator has preference above the & operator.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot convert from long to byte