Android Question Bit.AND and Bit.Or for Longs

Discussion in 'Android Questions' started by Robert Valentino, May 14, 2015.

  1. Robert Valentino

    Robert Valentino Well-Known Member Licensed User

    Does anyone have a library that will allow modifying then bits in long values

    I want to be able to use a long (64 bits) for flags and the Bit operations only return longs.

    Has anyone made a library that works with longs?

    BobVal
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Create a class module with this code:
    Code:
    Sub Class_Globals
       
    Private jo As JavaObject
    End Sub

    Public Sub Initialize
       jo = Me
    End Sub

    public Sub AndLong (N1 As Long, N2 As Long) As Long
       
    Return jo.RunMethod("andLong"Array(N1, N2))
    End Sub

    public Sub OrLong (N1 As Long, N2 As Long) As Long
       
    Return jo.RunMethod("orLong"Array(N1, N2))
    End Sub

    #If JAVA
    public long andLong (long n1, long n2) {
       return n1 & n2;
    }
    public long orLong (long n1, long n2) {
       return n1 | n2;
    }
    #End If
     
  3. Robert Valentino

    Robert Valentino Well-Known Member Licensed User

    Thanks so much
     
    Last edited: May 14, 2015
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice