• Post Reply Bookmark Topic Watch Topic
  • New Topic

convert long to byte ?  RSS feed

 
Anto Telvin
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

how can i convert a long to byte manually?
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anto,

do you really want to convert a long to a byte? This usually leads to a loss of precision because a long has a much higher value range and is probably not a very good idea. What exactly do you want to achieve?

Marco
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by 'manually' do you mean on paper, using your brain? or do you mean using java code?

cause neither really makes much sense...
 
Anto Telvin
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
want to do it in a paper without waiting for the compiler to produce the output thanks
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See your other topic....

http://www.coderanch.com/t/411768/java/java/converting-int-byte

It's basically the same thing, except with a long you truncate more bytes. (using only the lower order byte)

Henry
 
Anto Telvin
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!