BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 10-11-2008, 09:44 PM   #1
Dan East
Thumbs Must Hurt
 
Join Date: Apr 2008
Model: 8130
PIN: N/A
Carrier: US Cellular
Posts: 82
Default Generic Java - cast int[] to byte[]

Please Login to Remove!

Dealing with an 8 bit byte array is much slower than a 32 bit int array, so I want to use the same technique I use in C, which is to perform binary arithmetic in 32 bit, then cast the int array to a byte array. An actual conversion is out of the question, and would defeat the whole purpose.

The specific reason is the Bitmap constructor takes a byte[] for raw data, but manipulating bytes is too slow, so I need to access the array as int[] (each element being a pair of pixels), then pass it to the Bitmap constructor as byte[].

A simple cast to (byte[]) results in an "inconvertible types" compiler error. Any way to do this?

Last edited by Dan East; 10-11-2008 at 09:46 PM..
Offline  
Old 10-11-2008, 10:24 PM   #2
RemyJ
CrackBerry Addict
 
Join Date: May 2005
Location: Golden, CO US
Model: 9700
Carrier: ATT
Posts: 684
Default

Nope. Not without copying the array. Arrays are objects in Java so you just can't do the same things to them as you can in C.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Vintage Mitutoyo No 509-123 6” Dial Venier Height Gage With Original Box picture

Vintage Mitutoyo No 509-123 6” Dial Venier Height Gage With Original Box

$105.00



Vintage Ohaus APOTHECARY Pharmacist Weight Set #5601 picture

Vintage Ohaus APOTHECARY Pharmacist Weight Set #5601

$17.06



Leather Bound Vintage Journal, Notebook, Sketchbook, Planner, Spell book picture

Leather Bound Vintage Journal, Notebook, Sketchbook, Planner, Spell book

$15.00



Vintage Craftsman Tapered 5-1/2

Vintage Craftsman Tapered 5-1/2" Reamer with 3-3/4" T-Handle

$16.99



Vintage Lenk Rugged Jumbo Soldering Iron picture

Vintage Lenk Rugged Jumbo Soldering Iron

$25.00



Vintage Lot of 46 Machinist Lathe Cutter & Blank Bits. REXaa & Assorted Brands picture

Vintage Lot of 46 Machinist Lathe Cutter & Blank Bits. REXaa & Assorted Brands

$78.00







Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.