Questions tagged [bit]

A bit is a single binary digit.

A bit refers to a single binary digit, the smallest possible amount of information. In print is usually represented as either 0 or 1, with many different representations in technology, like the presence or absence of an electric current or magnetic field.

Eight bits form a single , although historically the term has been used for other sizes as well.

3593 questions
1
vote
1 answer

Understanding the strictMath java library

I got bored and decided to dive into remaking the square root function without referencing any of the Math.java functions. I have gotten to this point: package sqrt; public class SquareRoot { public static void main(String[] args) { …
Deek3117
  • 57
  • 8
1
vote
2 answers

Java Integer index to bit position

I'm trying to make a dynamic method to check a number through binary anding. I've tried a variety of different approaches but just can't wrap my head around it. what I need is a method that converts an integer index position and returns a…
Simon Jensen
  • 488
  • 1
  • 3
  • 19
1
vote
1 answer

javascript decimal (16 lower bits) to decimal

Sorry but i'm not good at bit conversion. I need to convert decimal -> decimal by lower 16 bit, as this sample. 1:16777237 decimal = 1000015 hex 2:16 lower bits = 0015 hex (each digit in hexadecimal is 4 bits) 3: 0015 hex = 21 decimal (21 is the…
Stweet
  • 683
  • 3
  • 11
  • 26
1
vote
3 answers

Extract a bit sequence from a character

So I have an array of characters like the following {h,e,l,l,o,o} so I need first to translate this to its bit representation, so what I would have is this h = 01101000 e = 01100101 l = 01101100 l = 01101100 o = 01101111 o = 01101111 I need divide…
ravelinx
  • 1,557
  • 4
  • 18
  • 26
1
vote
2 answers

Scala bit operation

I'm doing some research on scala bit operation as below: scala> val b = 8 b: Int = 8 scala> var c:Int = b | (1<<4) c: Int = 24 scala> var c:Int = c | (1<<5) c: Int = 32 I don't understand why the result looks correct when assign value from b to c…
Lionel
  • 13
  • 4
1
vote
0 answers

hibernate ddl-auto=update for indexed column("bit NOT NULL DEFAULT 0") result in reset of data to 0

MySQL Version = 5.5.51 SpringBoot Version = 1.2.8.RELEASE mysql-connector-java = 5.1.36 Given: I have an entity which has an index on a column(deliveryIndicator) whose data type is "bit NOT NULL DEFAULT 0". I have set ddl-auto to update in my…
sanjaykumar81
  • 435
  • 1
  • 6
  • 13
1
vote
1 answer

Python 3: return single Bits from a memoryview

Working with python 3.5, I recieve a single byte from a PostgreSQL as memoryview. >>> mybyte >>> bytes(mybyte) b'\x04' How can I read the single Bits of this Byte? Is there a way to get a bitwise representation of this…
1
vote
0 answers

SharpBits crashes after 60 jobs have been added, how to extend?

The issue I have is that when I am downloading all the 'Slides' from the server, if there is more than 60 the application will crash. The reason for this is that SharpBits does not allow more than 60 Jobs. Is there a way I can set the maximum amount…
Ben Clarke
  • 1,051
  • 4
  • 21
  • 47
1
vote
2 answers

Check the Number of Powers of 2

I have a number X , I want to check the number of powers of 2 it have ? For Ex N=7 ans is 2 , 2*2 N=20 ans is 4, 2*2*2*2 Similar I want to check the next power of 2 For Ex: N=14 Ans=16 Is there any Bit Hack for this without using for loops…
user6250837
  • 458
  • 2
  • 21
1
vote
1 answer

C#: Manual bit conversion?

Is there a better way to write this than using BitConverter? public static class ByteArrayExtensions { public static int IntFromUInt24(this byte[] bytes) { if (bytes == null) { throw new ArgumentNullException(); …
GoHeavyOrGoHome
  • 273
  • 1
  • 3
  • 4
1
vote
2 answers

Creating masks for specific nibbles

How can I - in an as efficient manner as possible - create a mask for all nibbles in an unsigned 64-bit integer that match a certain value? For example, suppose I have a 64-bit unsigned integer: 0000 0100 0011 0011 0011 0011 0010 0010 0010 0010 0010…
SJWard
  • 3,629
  • 5
  • 39
  • 54
1
vote
1 answer

Distance between ones in bit vector

Could you pls help me in this type of task.Actually I dont understand what I should provide as an answer A given bit vector has length n. It is known that the vector can contain only two ones. A combinational system needs to calculate the distance…
Kooss
  • 71
  • 1
  • 1
  • 8
1
vote
2 answers

Weird bit values from MySQL table

Having inserted a MySQL table values to a JTable and previewing this JTable, I noticed that the "BIT" column is returning a "1" as a strange box which I am unable to paste into here, and it returns 0's as blanks. I'll leave a screenshot of the bit…
Plumel
  • 45
  • 9
1
vote
2 answers

K&R Exercise 3-4: Negative Numbers Represented In Binary

I'm having a hard time understanding this exercise: In a two's complement number representation, our version of itoa does not handle the largest negative number, that is, the value of n equal to -(2^(wordsize-1)). Explain why not. Modify it to…
boy
  • 39
  • 2
1
vote
2 answers

Bit representation of a C vector

Working in little endian, which is excatly (including eof if there is) the bit representation of a C vector like this? unsigned char vet[] = {0x0f, 0x05};
glc78
  • 439
  • 1
  • 8
  • 20